summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-01-15 11:18:42 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-01-15 11:18:42 +0100
commitee19b41203a75aabaafa8093f3b6ef487a9febc8 (patch)
treef3842eb812893ff211f2b1bfd485407265216509 /maintainers
parent3a51aec945ecbc4ca3a0aaf4a14ce2009710d5d7 (diff)
Update the tarball mirroring scripts
Diffstat (limited to 'maintainers')
-rwxr-xr-xmaintainers/scripts/copy-tarball.sh10
-rwxr-xr-xmaintainers/scripts/copy-tarballs.sh14
2 files changed, 18 insertions, 6 deletions
diff --git a/maintainers/scripts/copy-tarball.sh b/maintainers/scripts/copy-tarball.sh
index b4c2e93dab177..de325120efc86 100755
--- a/maintainers/scripts/copy-tarball.sh
+++ b/maintainers/scripts/copy-tarball.sh
@@ -10,25 +10,25 @@ 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
+if [ -e "$dstPath" ]; then if [ -n "$VERBOSE" ]; then echo "$dstPath already exists"; fi; exit 0; fi
 
 if [ -z "$file" ]; then
 
     echo "downloading $url to $dstPath"
 
-    if [ -n "$dryRun" ]; then exit 0; fi
+    if [ -n "$DRY_RUN" ]; then exit 0; fi
 
     declare -a res
     if ! res=($(PRINT_PATH=1 nix-prefetch-url "$url")); then
-        continue
+        exit
     fi
-    
+
     storePath=${res[1]}
 
 else
     storePath="$file"
 fi
-    
+
 cp $storePath "$dstPath.tmp.$$"
 mv -f "$dstPath.tmp.$$" "$dstPath"
 
diff --git a/maintainers/scripts/copy-tarballs.sh b/maintainers/scripts/copy-tarballs.sh
index 80aeef9d66de1..b25326d1af327 100755
--- a/maintainers/scripts/copy-tarballs.sh
+++ b/maintainers/scripts/copy-tarballs.sh
@@ -8,7 +8,19 @@ urls=$(nix-instantiate --eval-only --xml --strict '<nixpkgs/maintainers/scripts/
 
 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
-    if ! echo "$url" | grep -q -E "\-.*[0-9].*"; then echo "skipping $url"; continue; fi
+
+    # Check the URL scheme.
+    if ! echo "$url" | grep -q -E "^[a-z]+://"; then echo "skipping $url (no URL scheme)"; continue; fi
+
+    # Check the basename.  It should include something resembling a version.
+    base="$(basename "$url")"
+    #if ! echo "$base" | grep -q -E "[-_].*[0-9].*"; then echo "skipping $url (no version)"; continue; fi
+    if ! echo "$base" | grep -q -E "[a-zA-Z]"; then echo "skipping $url (no letter in name)"; continue; fi
+    if ! echo "$base" | grep -q -E "[0-9]"; then echo "skipping $url (no digit in name)"; continue; fi
+    if ! echo "$base" | grep -q -E "[-_\.]"; then echo "skipping $url (no dot/underscore in name)"; continue; fi
+    if echo "$base" | grep -q -E "[&?=]"; then echo "skipping $url (bad character in name)"; continue; fi
+    if [ "${base:0:1}" = "." ]; then echo "skipping $url (starts with a dot)"; continue; fi
+
     $(dirname $0)/copy-tarball.sh "$url"
 done