euscan: Improving Berlios and Sourceforge handlers

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-08-08 12:20:33 +02:00
parent 77f1cb52ea
commit 0124465806
2 changed files with 8 additions and 4 deletions

View File

@ -9,11 +9,14 @@ from euscan import output
HANDLER_NAME = "berlios" HANDLER_NAME = "berlios"
CONFIDENCE = 90 CONFIDENCE = 90
PRIORITY = 95 PRIORITY = 90
berlios_regex = r"berlios.de/([^/]+)/([^/]+)"
def can_handle(pkg, url=None): def can_handle(pkg, url=None):
return url and "berlios.de/" in url return url and re.search(berlios_regex, url)
def scan_url(pkg, url, options): def scan_url(pkg, url, options):
@ -21,7 +24,7 @@ def scan_url(pkg, url, options):
cp, ver, rev = portage.pkgsplit(pkg.cpv) cp, ver, rev = portage.pkgsplit(pkg.cpv)
project, filename = re.search(r"berlios.de/(.+)/(.+)", url).groups() project, filename = re.search(berlios_regex, url).groups()
project_page = "http://developer.berlios.de/projects/%s" % project project_page = "http://developer.berlios.de/projects/%s" % project
content = urllib.urlopen(project_page).read() content = urllib.urlopen(project_page).read()

View File

@ -20,7 +20,8 @@ def scan_url(pkg, url, options):
cp, ver, rev = portage.pkgsplit(pkg.cpv) cp, ver, rev = portage.pkgsplit(pkg.cpv)
project, filename = re.search("sourceforge.net/(.+)/(.+)", url).groups() project, filename = re.search("sourceforge.net/([^/]+)/(?:.*/)?([^/]+)",
url).groups()
base_url = "http://qa.debian.org/watch/sf.php/%s" % project base_url = "http://qa.debian.org/watch/sf.php/%s" % project
file_pattern = regex_from_template( file_pattern = regex_from_template(
filename.replace(ver, "${PV}") filename.replace(ver, "${PV}")