[packages/adapter: 403/631] - move url unify to one function

glen glen at pld-linux.org
Mon Sep 12 20:08:13 CEST 2016


commit 8ea8f0aed4d2de252b54be8fbdf5cf7e1a978aa0
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Fri Apr 4 20:39:48 2008 +0000

    - move url unify to one function
    
    Changed files:
        adapter.awk -> 1.385

 adapter.awk | 49 ++++++++++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 21 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index 8ebf9e9..31bee4a 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -930,27 +930,7 @@ preamble == 1 {
 		# 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 @@ function cflags(var)
 	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) {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885



More information about the pld-cvs-commit mailing list