Author: glen                         Date: Wed Feb  9 14:38:19 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- sf url unify

---- Files affected:
packages:
   adapter.awk (1.487 -> 1.488) 

---- Diffs:

================================================================
Index: packages/adapter.awk
diff -u packages/adapter.awk:1.487 packages/adapter.awk:1.488
--- packages/adapter.awk:1.487  Mon Jan 31 08:44:39 2011
+++ packages/adapter.awk        Wed Feb  9 15:38:13 2011
@@ -1663,12 +1663,18 @@
        return 1
 }
 
+# return whole matched pattern
+function matchstr(str, pat)
+{
+       match(str, "[^/]+$");
+       return substr(str, RSTART, RLENGTH);
+}
+
 function unify_url(url)
 {
 
        # sourceforge urls
        # Docs about sourceforge mirror system: 
http://sourceforge.net/apps/trac/sourceforge/wiki/Mirrors
-       # TODO: SF unify: http://downloads.sourceforge.net/PROJECT/TARBALL
 
        # 1. unify domains
        sub("^http://prdownloads\.sourceforge\.net/";, 
"http://downloads.sourceforge.net/";, url)
@@ -1679,13 +1685,6 @@
        sub("^http://dl\.sf\.net/";, "http://downloads.sourceforge.net/";, url)
        sub("^http://downloads\.sourceforge\.net/sourceforge/";, 
"http://downloads.sourceforge.net/";, url)
 
-       # 2. special hacks
-       # new style urls, strip "files/" between and prepend dl.
-       if (match(url, "^http://sourceforge.net/projects/[^/]+/files/";)) {
-               url = substr(url, 1, RLENGTH - length("files/")) substr(url, 
RSTART + RLENGTH);
-               sub("^http://sourceforge.net/projects/";, 
"http://downloads.sourceforge.net/project/";, url);
-       }
-
        # 3. unify urls
        if (url ~ /sourceforge.net/) {
                sub("[?&]big_mirror=.*$", "", url);
@@ -1693,6 +1692,18 @@
                sub("[?]use_mirror=.*$", "", url);
                sub("[?]download$", "", url);
                sub("/download$", "", url);
+       }
+
+       # SF: new style urls, strip "files/" between and prepend dl.
+       if (match(url, "^http://sourceforge.net/projects/[^/]+/files/";)) {
+               url = substr(url, 1, RLENGTH - length("files/")) substr(url, 
RSTART + RLENGTH);
+               sub("^http://sourceforge.net/projects/";, 
"http://downloads.sourceforge.net/project/";, url);
+       }
+
+       # SF unify: http://downloads.sourceforge.net/PROJECT/TARBALL
+       # 
http://downloads.sourceforge.net/project/PROJECT/FILE/VERSION/%{name}-%{version}.zip
+       if (match(url, "^http://downloads.sourceforge.net/project/[^/]+";)) {
+               url = sprintf("http://downloads.sourceforge.net/%s/%s";, 
substr(url, 42, RLENGTH - 41), matchstr(url, "[^/]+$"));
        }
 
        sub("^ftp://ftp\.gnome\.org/";, "http://ftp.gnome.org/";, url)
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/adapter.awk?r1=1.487&r2=1.488&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to