diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-03-09 17:29:17 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-03-09 17:29:17 +0000 |
commit | a736ed4e663852af46bb2092d592e57c40907853 (patch) | |
tree | 8f4ba1b35fe7d0247c305fb7f5edab0b02505280 /maintainers | |
parent | d6ae44060b1e6f5ab577843423ee674f6599eaa4 (diff) | |
download | nixpkgs-a736ed4e663852af46bb2092d592e57c40907853.tar nixpkgs-a736ed4e663852af46bb2092d592e57c40907853.tar.gz nixpkgs-a736ed4e663852af46bb2092d592e57c40907853.tar.bz2 nixpkgs-a736ed4e663852af46bb2092d592e57c40907853.tar.lz nixpkgs-a736ed4e663852af46bb2092d592e57c40907853.tar.xz nixpkgs-a736ed4e663852af46bb2092d592e57c40907853.tar.zst nixpkgs-a736ed4e663852af46bb2092d592e57c40907853.zip |
* Split off copy-tarball.sh from copy-tarballs.sh. The former mirrors a single URL.
svn path=/nixpkgs/trunk/; revision=32960
Diffstat (limited to 'maintainers')
-rwxr-xr-x | maintainers/scripts/copy-tarball.sh | 36 | ||||
-rwxr-xr-x | maintainers/scripts/copy-tarballs.sh | 47 |
2 files changed, 38 insertions, 45 deletions
diff --git a/maintainers/scripts/copy-tarball.sh b/maintainers/scripts/copy-tarball.sh new file mode 100755 index 00000000000..9070977d7ce --- /dev/null +++ b/maintainers/scripts/copy-tarball.sh @@ -0,0 +1,36 @@ +#! /bin/sh -e + +distDir=/data/webserver/tarballs + +url="$1" +if [ -z "$url" ]; then echo "syntax: $0 URL"; exit 0; fi + +base="$(basename "$url")" +if [ -z "$base" ]; then echo "bad URL"; exit 1; fi +dstPath="$distDir/$base" + +if [ -e "$dstPath" ]; then echo "$dstPath already exists"; exit 0; fi + +echo "downloading $url to $newPath" + +if [ -n "$dryRun" ]; then exit 0; fi + +declare -a res +if ! res=($(PRINT_PATH=1 nix-prefetch-url "$url")); then + continue +fi +storePath=${res[1]} +cp $storePath "$dstPath.tmp.$$" +mv -f "$dstPath.tmp.$$" "$dstPath" + +echo "hashing $dstPath" + +md5=$(nix-hash --flat --type md5 "$dstPath") +ln -sfn "../$base" $distDir/md5/$md5 + +sha1=$(nix-hash --flat --type sha1 "$dstPath") +ln -sfn "../$base" $distDir/sha1/$sha1 + +sha256=$(nix-hash --flat --type sha256 "$dstPath") +ln -sfn "../$base" $distDir/sha256/$sha256 +ln -sfn "../$base" $distDir/sha256/$(nix-hash --type sha256 --to-base32 "$sha256") diff --git a/maintainers/scripts/copy-tarballs.sh b/maintainers/scripts/copy-tarballs.sh index c8f35710003..c1ed9039191 100755 --- a/maintainers/scripts/copy-tarballs.sh +++ b/maintainers/scripts/copy-tarballs.sh @@ -1,57 +1,14 @@ #! /bin/sh -e -distDir=/data/webserver/tarballs - -urls=$(nix-instantiate --eval-only --xml --strict ./eval-release.nix \ +urls=$(nix-instantiate --eval-only --xml --strict '<nixpkgs/maintainers/scripts/eval-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 - + $(dirname $0)/copy-tarball.sh "$url" done echo DONE |