tmpfileerr = mktemp()
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|downloads|dl)\.(sf|sourceforge)\.net/", "", url)
- gsub("/.*", "", url)
- url = sf_url(url)
+ 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)
}
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)
}
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) {
}
}
-function sf_url(sf_project) {
- 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)
- return "http://sourceforge.net/api/file/index/project-id/" sf_id "/mtime/desc/limit/20/rss"
-}
-
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"