]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - pldnotify.awk
allow redefine _applnkdir in .spec
[packages/rpm-build-tools.git] / pldnotify.awk
index 2b473988d3a7a8cf1db4e66e861dff7716fb234d..3b64774049849a5763b2c2f2425f8f540b6a8607 100755 (executable)
@@ -232,13 +232,18 @@ 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/"
-               d("sf url, mungled url to: " url)
+               gsub("^http://(download|downloads|dl)\.(sf|sourceforge)\.net/", "", newurl)
+               gsub("^project/", "", newurl)
+               gsub("/.*", "", newurl)
+               newurl = sf_url(newurl)
+               if (newurl ~ /^http/) {
+                       url = newurl
+                       d("sf url, mungled url to: " url)
+               }
 
        } else if (url ~ /^http:\/\/(.*)\.googlecode\.com\/files\//) {
                gsub("^http://", "", url)
@@ -251,9 +256,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 +313,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 +387,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 +413,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 +433,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 +448,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 +462,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 +492,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) {
@@ -595,6 +626,20 @@ function process_source(number, lurl, name, version) {
        }
 }
 
+function sf_url(sf_project) {
+       sf_url_new = ""
+       sf_idurl="http://sourceforge.net/api/project/name/" sf_project "/json"
+       cmd = "wget -t 2 -T 45 -q -O - " sf_idurl " |  awk -F: '/\"id\":/ { gsub(\",\", \"\", $2); print $2 } '"
+       d("sf_url_cmd: " cmd)
+       cmd | getline sf_id
+       d("sf_url_id: " sf_id)
+       if (sf_id ~ /^[0-9]+$/) {
+               sf_url_new = "http://sourceforge.net/api/file/index/project-id/" sf_id "/mtime/desc/limit/20/rss"
+               d("sf_url_new: " sf_url_new)
+       }
+       return sf_url_new
+}
+
 function rss_upgrade(name, ver, url, regex, cmd) {
        regex = "s/.*<title>" regex "<\/title>.*/\\1/p"
        cmd = "wget -t 2 -T 45 -q -O - " url " | sed -nre '" regex "' | head -n1"
@@ -717,7 +762,7 @@ function process_data(name, ver, rel,     src, nver, i) {
                nver = google_linux_repo(name, ver, "talkplugin");
        } else if (name ~ "^nodejs-") {
                nver = nodejs_upgrade(name, ver);
-       } else if (name ~ "^ruby-") {
+       } else if (name ~ "^ruby-" || name == "chef") {
                nver = rubygem_upgrade(name, ver);
        } else if (name ~ "jenkins") {
                nver = jenkins_upgrade(name, ver, src);
This page took 0.04088 seconds and 4 git commands to generate.