]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - pldnotify.awk
adapter: random changes
[packages/rpm-build-tools.git] / pldnotify.awk
index 9c0ca742c0cca210e0d5ed2dd1082dd2a409d735..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) {
@@ -679,10 +707,10 @@ function rubygem_upgrade(name, ver,   cmd, pkg) {
        return ver
 }
 
-function chrome_upgrade(name, ver,   cmd, sourceurl) {
-       sourceurl = "http://dl.google.com/linux/chrome/rpm/stable/x86_64/repodata/primary.xml.gz"
-       cmd = "curl -s " sourceurl " | zcat | perl -ne 'm{<name>google-chrome-" DEFS["state"] "</name>} and m{<version .*ver=.([\d.]+)} and print $1'"
-       d("CHROME " cmd);
+function google_linux_repo(name, ver, reponame,   cmd, sourceurl) {
+       sourceurl = "http://dl.google.com/linux/" reponame "/rpm/stable/x86_64/repodata/primary.xml.gz"
+       cmd = "curl -s " sourceurl " | zcat | perl -ne 'm{<name>" name "-" DEFS["state"] "</name>} and m{<version .*ver=.([\d.]+)} and print $1'"
+       d("google repo: " cmd);
        cmd | getline ver
        close(cmd)
 
@@ -712,10 +740,12 @@ function process_data(name, ver, rel,     src, nver, i) {
        } else if (name == "vim") {
                nver = vim_upgrade(name, ver);
        } else if (name == "google-chrome") {
-               nver = chrome_upgrade(name, ver);
+               nver = google_linux_repo(name, ver, "chrome");
+       } else if (name == "google-talkplugin") {
+               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.031024 seconds and 4 git commands to generate.