]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - pldnotify.awk
clean-distfiles: cosmetic
[packages/rpm-build-tools.git] / pldnotify.awk
index 935f41808747d52df9ec0ff03273c2fde50a19bc..abf049305981206c12eea26ce4b59979202c7c5c 100755 (executable)
@@ -232,12 +232,14 @@ function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowero
        tmpfile = mktemp()
        tmpfileerr = mktemp()
 
-       if (url ~ /^http:\/\/(download|dl)\.(sf|sourceforge)\.net\//) {
+       if (url ~ /^http:\/\/(download|downloads|dl)\.(sf|sourceforge)\.net\//) {
+               newurl = url
+               # http://dl.sourceforge.net/threestore/
                # http://downloads.sourceforge.net/project/mediainfo/source/mediainfo/
-               gsub("^http://(download|dl)\.(sf|sourceforge)\.net/", "", url)
-
-               gsub("/.*", "", url)
-               url = "http://sourceforge.net/projects/" url "/files/"
+               gsub("^http://(download|downloads|dl)\.(sf|sourceforge)\.net/", "", newurl)
+               gsub("^project/", "", newurl)
+               gsub("/.*", "", newurl)
+               url = "http://sourceforge.net/projects/" newurl "/rss?path=/"
                d("sf url, mungled url to: " url)
 
        } else if (url ~ /^http:\/\/(.*)\.googlecode\.com\/files\//) {
@@ -251,9 +253,10 @@ function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowero
                url = "http://pecl.php.net/package/" filename
                d("pecl.php.net url, mungled url to: " url)
 
-       } else if (url ~ /^(http|ftp):\/\/mysql.*\/Downloads\/MySQL-5.1\//) {
-               url = "http://dev.mysql.com/downloads/mysql/5.1.html#source"
-               d("mysql 5.1 url, mungled url to: " url)
+       } else if (url ~/http:\/\/cdn.mysql.com\//) {
+               gsub("http:\/\/cdn.mysql.com\/", "", url)
+               url = "http://vesta.informatik.rwth-aachen.de/mysql/" url
+               d("mysql CDN, mungled url to: " url)
 
        } else if (url ~ /^(http|https):\/\/launchpad\.net\/(.*)\//) {
                gsub("^(http|https):\/\/launchpad\.net\/", "", url)
@@ -307,6 +310,12 @@ function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowero
        } else if (url ~ /^http:\/\/www.taskwarrior.org\/download\//) {
                url = "http://taskwarrior.org/projects/taskwarrior/wiki/Download"
                d("taskwarrior tarball url, mungled url to: " url)
+       } else if (url ~/^http:\/\/www.rarlab.com\/rar\// && filename ~ /^unrarsrc/) {
+               url = "http://www.rarlab.com/rar_add.htm"
+               d("unrar tarball url, mungled url to: " url)
+       } else if (url ~/^http:\/\/www.rarlab.com\/rar\//) {
+               url = "http://www.rarlab.com/download.htm"
+               d("rar tarball url, mungled url to: " url)
        }
 
        d("Retrieving: " url)
@@ -375,7 +384,11 @@ if (USE_PERL) {
        d("Reponse read done...")
        system("rm -f " tmpfile)
 
-       while (match(wholeodp, /<([aA]|[fF][rR][aA][mM][eE])[ \t][^>]*>/) > 0) {
+       # MATCH one of these:
+       #while (match(wholeodp, /<([aA]|[fF][rR][aA][mM][eE])[ \t][^>]*>/) > 0) {
+       #while (match(wholeodp, /<link>[^<]*<\/link>/) > 0) {
+
+       while (match(wholeodp, /(<link>[^<]*<\/link>|<([aA]|[fF][rR][aA][mM][eE])[ \t][^>]*>)/) > 0) {
                d("Processing links...")
                odp = substr(wholeodp,RSTART,RLENGTH);
                wholeodp = substr(wholeodp,RSTART+RLENGTH);
@@ -397,6 +410,7 @@ if (USE_PERL) {
                        }
 
                        retval = (retval " " get_links(newurl))
+                       d("href('condition1': " newurl)
                } else if (lowerodp ~ /href=[ \t]*"[^"]*"/) {
                        sub(/[hH][rR][eE][fF]=[ \t]*"/,"href=\"",odp)
                        match(odp,/href="[^"]*"/)
@@ -416,7 +430,7 @@ if (USE_PERL) {
                                mlink = get_links(link)
 
                        retval = (retval " " link " " mlink)
-                       d("href(\"\"): " link)
+                       d("href('condition2'): " link)
                } else if (lowerodp ~ /href=[ \t]*'[^']*'/) {
                        sub(/[hH][rR][eE][fF]=[ \t]*'/,"href='",odp)
                        match(odp,/href='[^']*'/)
@@ -431,7 +445,7 @@ if (USE_PERL) {
                        }
 
                        retval = (retval " " link)
-                       d("href(''): " link)
+                       d("href('condition3'): " link)
                } else if (lowerodp ~ /href=[ \t]*[^ \t>]*/) {
                        sub(/[hH][rR][eE][fF]=[ \t]*/,"href=",odp)
                        match(odp,/href=[^ \t>]*/)
@@ -445,7 +459,19 @@ if (USE_PERL) {
                        }
 
                        retval = (retval " " link)
-                       d("href(): " link)
+                       d("href('condition4'): " link)
+               } else if (lowerodp ~ /<link>/) {
+                       link=lowerodp
+                       sub("/<link>/", link)
+                       sub("/\/download<\/link>/", link)
+
+                       if (link_seen(link)) {
+                               link=""
+                               continue
+                       }
+
+                       retval = (retval " " link)
+                       d("href('condition5'): " link)
                } else {
                        # <a ...> but not href - skip
                        d("skipping <a > without href: " odp)
@@ -463,6 +489,8 @@ function subst_defines(var,defs) {
                for (j in defs) {
                        gsub("%{" j "}", defs[j], var)
                        gsub("%" j , defs[j], var)
+                       # conditional macros like %{?patchlevel:.5} - drop these for now
+                       gsub("%{\?" j ":.*?}", "", var)
                }
                if (var==oldvar) {
                        if (DEBUG) {
This page took 0.031032 seconds and 4 git commands to generate.