1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 05:29:32 +00:00

bitbake: fetch2/wget.py: _check_latest_version_by_dir use group names

Little improvement for reference tokens by names instead of index.

(Bitbake rev: e8ea15eeb1857ed4bb6337836bd2fb1f5dbb1bdf)

Signed-off-by: Aníbal Limón <limon.anibal@gmail.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Aníbal Limón
2016-03-24 12:08:18 -06:00
committed by Richard Purdie
parent 55cd35bd18
commit 45ee2b1079
+4 -4
View File
@@ -420,10 +420,10 @@ class Wget(FetchMethod):
version_dir = ['', '', ''] version_dir = ['', '', '']
version = ['', '', ''] version = ['', '', '']
dirver_regex = re.compile("(\D*)((\d+[\.\-_])+(\d+))") dirver_regex = re.compile("(?P<pfx>\D*)(?P<ver>(\d+[\.\-_])+(\d+))")
s = dirver_regex.search(dirver) s = dirver_regex.search(dirver)
if s: if s:
version_dir[1] = s.group(2) version_dir[1] = s.group('ver')
else: else:
version_dir[1] = dirver version_dir[1] = dirver
@@ -438,9 +438,9 @@ class Wget(FetchMethod):
for line in soup.find_all('a', href=True): for line in soup.find_all('a', href=True):
s = dirver_regex.search(line['href'].strip("/")) s = dirver_regex.search(line['href'].strip("/"))
if s: if s:
version_dir_new = ['', s.group(2), ''] version_dir_new = ['', s.group('ver'), '']
if self._vercmp(version_dir, version_dir_new) <= 0: if self._vercmp(version_dir, version_dir_new) <= 0:
dirver_new = s.group(1) + s.group(2) dirver_new = s.group('pfx') + s.group('ver')
path = ud.path.replace(dirver, dirver_new, True) \ path = ud.path.replace(dirver, dirver_new, True) \
.split(package)[0] .split(package)[0]
uri = bb.fetch.encodeurl([ud.type, ud.host, path, uri = bb.fetch.encodeurl([ud.type, ud.host, path,