euscan: add a quick /_rc/-rc/ hack
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
This commit is contained in:
parent
5bd358968a
commit
df1d778365
@ -40,11 +40,10 @@ def scan_ftp(data, url, pattern):
|
||||
|
||||
return results
|
||||
|
||||
def scan_directory_recursive(cpv, url, steps):
|
||||
def scan_directory_recursive(cp, ver, rev, url, steps):
|
||||
if not steps:
|
||||
return []
|
||||
|
||||
cp, ver, rev = portage.pkgsplit(cpv)
|
||||
url += steps[0][0]
|
||||
pattern = steps[0][1]
|
||||
|
||||
@ -85,7 +84,7 @@ def scan_directory_recursive(cpv, url, steps):
|
||||
versions.append((path, version))
|
||||
|
||||
if steps:
|
||||
ret = scan_directory_recursive(cpv, path, steps)
|
||||
ret = scan_directory_recursive(cp, ver, rev, path, steps)
|
||||
versions.extend(ret)
|
||||
|
||||
return versions
|
||||
@ -102,6 +101,13 @@ def scan(cpv, url):
|
||||
|
||||
cp, ver, rev = portage.pkgsplit(cpv)
|
||||
|
||||
# 'Hack' for _beta/_rc versions where _ is used instead of -
|
||||
if ver not in resolved_url:
|
||||
newver = helpers.version_change_end_sep(ver)
|
||||
if newver and newver in resolved_url:
|
||||
euscan.output.einfo("Version: using %s instead of %s" % (newver, ver))
|
||||
ver = newver
|
||||
|
||||
template = helpers.template_from_url(resolved_url, ver)
|
||||
if '${' not in template:
|
||||
euscan.output.einfo("Url doesn't seems to depend on version: %s not found in %s"
|
||||
@ -111,7 +117,7 @@ def scan(cpv, url):
|
||||
euscan.output.einfo("Scanning: %s" % template)
|
||||
|
||||
steps = helpers.generate_scan_paths(template)
|
||||
return scan_directory_recursive(cpv, "", steps)
|
||||
return scan_directory_recursive(cp, ver, rev, "", steps)
|
||||
|
||||
def brute_force(cpv, url):
|
||||
cp, ver, rev = portage.pkgsplit(cpv)
|
||||
|
@ -30,7 +30,8 @@ VERSION_CMP_PACKAGE_QUIRKS = {
|
||||
'sys-process/htop' : htop_vercmp
|
||||
}
|
||||
|
||||
_v = r'((\d+)((\.\d+)*)([a-zA-Z]*?)(((-|_)(pre|p|beta|b|alpha|a|rc|r)\d*)*))'
|
||||
_v_end = '((-|_)(pre|p|beta|b|alpha|a|rc|r)\d*)'
|
||||
_v = r'((\d+)((\.\d+)*)([a-zA-Z]*?)(' + _v_end + '*))'
|
||||
|
||||
def cast_int_components(version):
|
||||
for i, obj in enumerate(version):
|
||||
@ -91,6 +92,19 @@ def version_blacklisted(cp, version):
|
||||
euscan.output.einfo("%s is blacklisted by rule %s" % (cpv, bv))
|
||||
return rule is not None
|
||||
|
||||
def version_change_end_sep(version):
|
||||
match = re.match('.*' + _v_end, version)
|
||||
if not match:
|
||||
return None
|
||||
end = match.group(1)
|
||||
if end[0] == '_':
|
||||
newend = end.replace('_', '-')
|
||||
elif end[0] == '-':
|
||||
newend = end.replace('-', '_')
|
||||
else:
|
||||
return None
|
||||
return version.replace(end, newend)
|
||||
|
||||
def version_filtered(cp, base, version):
|
||||
if vercmp(cp, base, version) >= 0:
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user