SPECS: adapter.awk - move url unify to one function

glen glen at pld-linux.org
Fri Apr 4 22:39:54 CEST 2008


Author: glen                         Date: Fri Apr  4 20:39:54 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- move url unify to one function

---- Files affected:
SPECS:
   adapter.awk (1.384 -> 1.385) 

---- Diffs:

================================================================
Index: SPECS/adapter.awk
diff -u SPECS/adapter.awk:1.384 SPECS/adapter.awk:1.385
--- SPECS/adapter.awk:1.384	Tue Mar 25 13:40:44 2008
+++ SPECS/adapter.awk	Fri Apr  4 22:39:48 2008
@@ -930,27 +930,7 @@
 		# assigning to $2 kills preamble formatting
 		$2 = fixedsub(filename, url[n], $2)
 
-		# sourceforge urls
-		sub("[?&]big_mirror=.*$", "", $2);
-		sub("[?&]modtime=.*$", "", $2);
-
-		sub("[?]use_mirror=.*$", "", $2);
-		sub("[?]download$", "", $2);
-
-		sub("^http://prdownloads\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
-		sub("^http://download\.sf\.net/", "http://dl.sourceforge.net/", $2)
-		sub("^http://download\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
-		sub("^http://downloads\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
-
-		sub("^http://.*\.dl\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
-		sub("^http://dl\.sourceforge\.net/sourceforge/", "http://dl.sourceforge.net/", $2)
-		sub("^http://dl\.sf\.net/", "http://dl.sourceforge.net/", $2)
-
-		sub("^ftp://ftp\.gnome\.org/", "http://ftp.gnome.org/", $2)
-		sub("^http://ftp\.gnome\.org/pub/gnome/", "http://ftp.gnome.org/pub/GNOME/", $2)
-
-		# apache urls
-		sub("^http://apache.zone-h.org/", "http://www.apache.org/dist/", $2)
+		$2 = unify_url($2)
 	}
 
 
@@ -1596,6 +1576,33 @@
 	return 1
 }
 
+function unify_url(url)
+{
+
+	# sourceforge urls
+	sub("[?&]big_mirror=.*$", "", url);
+	sub("[?&]modtime=.*$", "", url);
+	sub("[?]use_mirror=.*$", "", url);
+	sub("[?]download$", "", url);
+
+	sub("^http://prdownloads\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
+	sub("^http://download\.sf\.net/", "http://dl.sourceforge.net/", url)
+	sub("^http://download\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
+	sub("^http://downloads\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
+
+	sub("^http://.*\.dl\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
+	sub("^http://dl\.sourceforge\.net/sourceforge/", "http://dl.sourceforge.net/", url)
+	sub("^http://dl\.sf\.net/", "http://dl.sourceforge.net/", url)
+
+	sub("^ftp://ftp\.gnome\.org/", "http://ftp.gnome.org/", url)
+	sub("^http://ftp\.gnome\.org/pub/gnome/", "http://ftp.gnome.org/pub/GNOME/", url)
+
+	# apache urls
+	sub("^http://apache.zone-h.org/", "http://www.apache.org/dist/", url)
+
+	return url
+}
+
 function demacroize(str)
 {
 	if (mod_name) {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/adapter.awk?r1=1.384&r2=1.385&f=u



More information about the pld-cvs-commit mailing list