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\//) {
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)
} 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)
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);
}
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="[^"]*"/)
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='[^']*'/)
}
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>]*/)
}
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)
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) {
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)
} 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);