Author: raskin
Date: 2010-06-23 04:39:21 +0000 (Wed, 23 Jun 2010)
New Revision: 22388

You can view the changes in this commit at:
   https://svn.nixos.org/viewvc/nix?rev=22388&view=rev

Modified:
   nixpkgs/trunk/pkgs/build-support/upstream-updater/update-upstream-data.sh

Log:
Add a Sourceforge-friendly fetch method to upstream-updater

Changes:

Modified: 
nixpkgs/trunk/pkgs/build-support/upstream-updater/update-upstream-data.sh
===================================================================
--- nixpkgs/trunk/pkgs/build-support/upstream-updater/update-upstream-data.sh   
2010-06-22 21:07:09 UTC (rev 22387)
+++ nixpkgs/trunk/pkgs/build-support/upstream-updater/update-upstream-data.sh   
2010-06-23 04:39:21 UTC (rev 22388)
@@ -36,10 +36,44 @@
 commonPrefetchVars=" version name hash"
 
 prefetchClause=""
+[ fetchSF = "$method" ] && {
+    if [ -z "$forcedUrl" ]; then 
+       freshUrl="$("$own_dir"/urls-from-page.sh "$(getAttr downloadPage)" |
+          eval "egrep \"$(getAttr sourceRegexp 
'.*[.]tar[.].*|.*[.]tgz$|.*[.]tbz2$')\"" | 
+         eval "egrep -v \"$(getAttr blacklistRegexp '^$')\"" |
+          eval "$(getAttr choiceCommand 'head -1')")"
+
+       if ! egrep ':' <<< "$freshUrl" ; then 
+               freshUrl="$(dirname "$(getAttr downloadPage).")/$freshUrl"
+       fi
+
+       echo "Found download link: $freshUrl" >&2
+    else
+        freshUrl="$forcedUrl"
+    fi
+
+    freshUrl="$(echo "$freshUrl" | sed -re "$skipRedirectSF")"
+    echo "Sourceforge-corrected URL: $freshUrl" >&2
+    
+    version="$(echo "$freshUrl" | 
+      sed -re "$extractReleaseSF")"
+    baseName="$(getAttr baseName "$(echo "freshUrl" | sed -re 
's...@.*/projects/([^/]+)/....@\1@')")"
+    url="$freshUrl"
+    name="$baseName-$version"
+    advertisedUrl="$freshUrl"
+
+    if [ x"$freshUrl" = x"$(cat "$src_defs_dir"/advertisedUrl)" ]; then
+        echo "Source link not changed" >&2
+        exit
+    fi
+    hash=$(nix-prefetch-url "$freshUrl")
+
+    prefetchVars="url advertisedUrl";
+}
 [ fetchurl = "$method" ] && {
     if [ -z "$forcedUrl" ] ; then
         freshUrl="$("$own_dir"/urls-from-page.sh "$(getAttr downloadPage)" |
-          eval "egrep \"$(getAttr sourceRegexp '.*[.]tar[.].*')\"" | 
+          eval "egrep \"$(getAttr sourceRegexp  
'.*[.]tar[.].*|.*[.]tgz$|.*[.]tbz2$')\"" | 
          eval "egrep -v \"$(getAttr blacklistRegexp '^$')\"" |
           eval "$(getAttr choiceCommand 'head -1')")"
     

_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to