depot/third_party/nixpkgs/pkgs/applications/science/misc/openmodelica/update-src-libs-svn.sh
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

50 lines
835 B
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
CWD=`pwd`
chko() { (
T=`mktemp -d`
trap "rm -rf $T" EXIT INT PIPE
cd $T
cat >check.nix <<EOF
with import <nixpkgs> {};
fetchgit `cat $CWD/src-main.nix`
EOF
nix-build check.nix
cat result/libraries/Makefile.libs
) }
getsha256() { (
T=`mktemp -d`
trap "rm -rf $T" EXIT INT PIPE
cd $T
L=`echo $2 | wc -c`
cat >check.nix <<EOF
with import <nixpkgs> {};
fetchsvn {
url = $1;
rev = $2;
sha256 = "0000000000000000000000000000000000000000000000000000";
}
EOF
SHA=`nix-build check.nix 2>&1 | sed -n 's/.*instead has \(.*\).*/\1/g p'`
echo "{ url = $1; rev = $2; sha256=\"$SHA\"; }"
# nix-build check.nix
) }
OUT=src-libs-svn.nix
echo '[' > $OUT
chko |
grep checkout-svn.sh |
tr \' \" |
while read NM TGT URL REV ; do
echo Trying $TGT $URL $REV >&2
getsha256 $URL $REV >> $OUT || exit 1
done
echo ']' >> $OUT