diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-04-25 18:34:11 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-04-25 18:34:11 +0000 |
commit | ecd43e2bfe9bf845206da01c38c580bfae4660e2 (patch) | |
tree | 1ec1d650f179c2d90655f546fea6a23ea1c9a327 /maintainers | |
parent | c2d651ef68ff09efb67ca15f3ae1aae4baa4ce83 (diff) |
* Updated the script that copies tarballs used in Nixpkgs to
nixos.org/tarballs. It no longer greps the source for fetchurl calls, because a lot of URLs are now computed (e.g. "http://foo/${name}.tar.bz2"). So instead we evaluate the Nix expression with "nix-instantiate --xml --strict" and look for URLs in the result. Because I'm lazy the script no longer checks whether the hash of the download matches the hash in the expression. svn path=/nixpkgs/trunk/; revision=15310
Diffstat (limited to 'maintainers')
-rwxr-xr-x | maintainers/scripts/copy-tarballs.sh | 57 | ||||
-rwxr-xr-x | maintainers/scripts/evacuate-urls.sh | 83 |
2 files changed, 57 insertions, 83 deletions
diff --git a/maintainers/scripts/copy-tarballs.sh b/maintainers/scripts/copy-tarballs.sh new file mode 100755 index 0000000000000..76ced8a01d90f --- /dev/null +++ b/maintainers/scripts/copy-tarballs.sh @@ -0,0 +1,57 @@ +#! /bin/sh -e + +distDir=/data/webserver/tarballs + +urls=$(nix-instantiate --eval-only --xml --strict pkgs/top-level/build-for-release.nix \ + | grep -A2 'name="urls"' \ + | grep '<string value=' \ + | sed 's/.*"\(.*\)".*/\1/' \ + | sort | uniq) + +for url in $urls; do + + if echo "$url" | grep -q -E "www.cs.uu.nl|nixos.org|.stratego-language.org|java.sun.com|ut2004|linuxq3a|RealPlayer|Adbe|belastingdienst|microsoft|armijn/.nix|sun.com|archive.eclipse.org"; then continue; fi + + base="$(basename "$url")" + newPath="$distDir/$base" + + if ! test -e "$newPath"; then + + #if echo $url | grep -q 'mirror://'; then + # echo "$fn: skipping mirrored $url" + # continue + #fi + + echo "downloading $url to $newPath" + + if test -n "$doCopy"; then + declare -a res + if ! res=($(PRINT_PATH=1 nix-prefetch-url "$url")); then + continue + fi + storePath=${res[1]} + cp $storePath "$newPath.tmp.$$" + mv -f "$newPath.tmp.$$" "$newPath" + fi + + fi + + if test -n "$doCopy" -a -e "$newPath"; then + + echo "hashing $newPath" + + md5=$(nix-hash --flat --type md5 "$newPath") + ln -sfn "../$base" $distDir/md5/$md5 + + sha1=$(nix-hash --flat --type sha1 "$newPath") + ln -sfn "../$base" $distDir/sha1/$sha1 + + sha256=$(nix-hash --flat --type sha256 "$newPath") + ln -sfn "../$base" $distDir/sha256/$sha256 + ln -sfn "../$base" $distDir/sha256/$(nix-hash --type sha256 --to-base32 "$sha256") + + fi + +done + +echo DONE diff --git a/maintainers/scripts/evacuate-urls.sh b/maintainers/scripts/evacuate-urls.sh deleted file mode 100755 index 21c346e607cf3..0000000000000 --- a/maintainers/scripts/evacuate-urls.sh +++ /dev/null @@ -1,83 +0,0 @@ -#! /bin/sh -e - -distDir=/data/webserver/dist/tarballs - -find "$1" -name "*.nix" | while read fn; do - - grep -E '^ *url = ' "$fn" | while read line; do - - if url=$(echo "$line" | sed 's^url = \(.*\);^\1^'); then - - if ! echo "$url" | grep -q -E "www.cs.uu.nl|nixos.org|.stratego-language.org|java.sun.com|ut2004|linuxq3a|RealPlayer|Adbe|belastingdienst|microsoft|armijn/.nix|sun.com|archive.eclipse.org"; then - base="$(basename "$url")" - newPath="$distDir/$base" - - if test -e "$newPath"; then - - #echo "$fn: checking hash of existing $newPath" - hash=$(fgrep -A 1 "$url" "$fn" | grep md5 | sed 's^.*md5 = \"\(.*\)\";.*^\1^') - hashType=md5 - if test -z "$hash"; then - hash=$(fgrep -A 1 "$url" "$fn" | grep sha256 | sed 's^.*sha256 = \"\(.*\)\";.*^\1^') - hashType="sha256 --base32" - if test -n "$hash"; then - if test "${#hash}" = 64; then - hash=$(nix-hash --to-base32 --type sha256 $hash) - fi - else - hash=$(fgrep -A 1 "$url" "$fn" | grep sha1 | sed 's^.*sha1 = \"\(.*\)\";.*^\1^') - hashType="sha1" - if test -z "$hash"; then - echo "WARNING: $fn: cannot figure out the hash for $url" - continue - fi - fi - fi - #echo "HASH = $hash" - if ! test "$(nix-hash --type $hashType --flat "$newPath")" = "$hash"; then - echo "WARNING: $fn: $newPath exists and differs, hash should be $hash!" - continue - fi - - else - - if echo $url | grep -q 'mirror://'; then - #echo "$fn: skipping mirrored $url" - continue - fi - - echo "$fn: $url -> $newPath" - - if test -n "$doCopy"; then - if ! curl --disable-epsv --fail --location --max-redirs 20 --remote-time \ - "$url" --output "$newPath".tmp; then - continue - fi - mv -f "$newPath".tmp "$newPath" - fi - - fi - - if test -n "$doCopy" -a -e "$newPath"; then - - md5=$(nix-hash --flat --type md5 "$newPath") - ln -sfn "../$base" $distDir/md5/$md5 - - sha1=$(nix-hash --flat --type sha1 "$newPath") - ln -sfn "../$base" $distDir/sha1/$sha1 - - sha256=$(nix-hash --flat --type sha256 "$newPath") - ln -sfn "../$base" $distDir/sha256/$sha256 - ln -sfn "../$base" $distDir/sha256/$(nix-hash --type sha256 --to-base32 "$sha256") - - fi - - fi - - fi - - done - -done - -echo DONE |