From 60656d07ea87e0c905c4b4c01a76a696af0d0c4e Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Thu, 24 Mar 2016 12:08:19 -0600 Subject: bitbake: fetch2/wget.py: _check_latest_version_by_dir fix prefix detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When prefix is part of the version directory it need to ensure that only version directory is used so remove previous directories if exists. Example: pfx = '/dir1/dir2/v' and version = '2.5' the expected result is 'v2.5' instead of '/dir1/dir2/v2.5'. [YOCTO #8778] (Bitbake rev: c760531c6dbf88135ab9f8e6f0784ccbf2cce1e4) Signed-off-by: Aníbal Limón Signed-off-by: Aníbal Limón Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/wget.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/bb/fetch2/wget.py') diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index ffae5405b0..8bc9e93ca0 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -438,9 +438,19 @@ class Wget(FetchMethod): for line in soup.find_all('a', href=True): s = dirver_regex.search(line['href'].strip("/")) if s: - version_dir_new = ['', s.group('ver'), ''] + sver = s.group('ver') + + # When prefix is part of the version directory it need to + # ensure that only version directory is used so remove previous + # directories if exists. + # + # Example: pfx = '/dir1/dir2/v' and version = '2.5' the expected + # result is v2.5. + spfx = s.group('pfx').split('/')[-1] + + version_dir_new = ['', sver, ''] if self._vercmp(version_dir, version_dir_new) <= 0: - dirver_new = s.group('pfx') + s.group('ver') + dirver_new = spfx + sver path = ud.path.replace(dirver, dirver_new, True) \ .split(package)[0] uri = bb.fetch.encodeurl([ud.type, ud.host, path, -- cgit v1.2.3-54-g00ecf