euscan: generic handler fixes

* urljoin was broken with dirs ("http://site.com/lol" joined with "wat"
  produces http://site.com/wat)
* fixed _v regex, don't match what is not needed

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-07-25 10:44:15 +02:00 committed by Corentin Chary
parent 9f164ed22c
commit 112313ab7f
2 changed files with 12 additions and 5 deletions

View File

@ -35,7 +35,10 @@ def scan_html(data, url, pattern):
match = re.match(pattern, href, re.I)
if match:
results.append((".".join(match.groups()), match.group(0)))
results.append(
(".".join([x for x in match.groups() if x is not None]),
match.group(0))
)
return results
@ -47,8 +50,10 @@ def scan_ftp(data, url, pattern):
line = line.replace("\n", "").replace("\r", "")
match = re.search(pattern, line, re.I)
if match:
results.append((".".join(match.groups()), match.group(0)))
results.append(
(".".join([x for x in match.groups() if x is not None]),
match.group(0))
)
return results
@ -88,6 +93,8 @@ def scan_directory_recursive(cp, ver, rev, url, steps, orig_url):
pv = helpers.gentoo_mangle_version(up_pv)
if helpers.version_filtered(cp, ver, pv):
continue
if not url.endswith("/"):
url = url + "/"
path = urljoin(url, path)
if not steps and path not in orig_url:

View File

@ -30,8 +30,8 @@ VERSION_CMP_PACKAGE_QUIRKS = {
'sys-process/htop': htop_vercmp
}
_v_end = '((-|_)(pre|p|beta|b|alpha|a|rc|r)\d*)'
_v = r'((\d+)((\.\d+)*)([a-zA-Z]*?)(' + _v_end + '*))'
_v_end = r'(?:(?:-|_)(?:pre|p|beta|b|alpha|a|rc|r)\d*)'
_v = r'((?:\d+)(?:(?:\.\d+)*)(?:[a-zA-Z]*?)(?:' + _v_end + '*))'
# Stolen from g-pypi