summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2014-11-27 19:12:05 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-28 14:03:01 +0000
commit4b2932906c8d444f4dffebf3c665904844815806 (patch)
treeafd7d18b06e9e4cb9bf7c164d60bd8cc22b16162 /bitbake/lib
parentaf47f14c71026fb07ecb1342e5e0e1ef8bd0a2e5 (diff)
downloadast2050-yocto-poky-4b2932906c8d444f4dffebf3c665904844815806.zip
ast2050-yocto-poky-4b2932906c8d444f4dffebf3c665904844815806.tar.gz
bitbake: fetch/wget: latest_versionstring improvments in searching
Validate if package contain version string if not return the current version cases for spectrum-fw and corpus recipes. _check_latest_version return the latest version available don't take into account the current version previous this only return the upstream version if it greater than the current version. (Bitbake rev: 91a7ac8c7f87f98e366585cf9720ec35b0790bae) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py37
1 files changed, 23 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 1a585a5..7e4f432 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -227,18 +227,18 @@ class Wget(FetchMethod):
bb.debug(3, "Not Valid")
return None
- def _check_latest_version(self, url, package, ud, d):
+ def _check_latest_version(self, url, package, current_version, ud, d):
"""
Return the latest version of a package inside a given directory path
If error or no version, return ""
"""
valid = 0
- version = self._parse_path(self.package_custom_regex_comp, package)
+ version = ('', '', '')
bb.debug(3, "VersionURL: %s" % (url))
soup = BeautifulSoup(self._fetch_index(url, ud, d))
if not soup:
- bb.debug(3, "*** %s NO SOUP" % (package))
+ bb.debug(3, "*** %s NO SOUP" % (url))
return None
pn_regex = d.getVar('REGEX', True)
@@ -248,7 +248,7 @@ class Wget(FetchMethod):
bb.debug(3, "pn_regex = '%s'" % (pn_regex.pattern))
for line in soup.find_all('a', href=True):
- newver = ('', '', '')
+ newver = None
bb.debug(3, "line = '%s'" % (line['href']))
if pn_regex:
m = pn_regex.search(line['href'])
@@ -259,17 +259,19 @@ class Wget(FetchMethod):
continue
else:
newver = self._parse_path(self.package_custom_regex_comp, line['href'])
- valid = 1
- if newver and self._vercmp(version, newver) == True:
- version = newver
+
+ if newver:
+ bb.debug(3, "Upstream version found: %s" % newver[1])
+ if valid == 0:
+ version = newver
+ valid = 1
+ elif self._vercmp(version, newver) == True:
+ version = newver
# check whether a valid package and version were found
+ bb.debug(3, "*** %s -> UpstreamVersion = %s (CurrentVersion = %s)" %
+ (package, version[1] or "N/A", current_version[1]))
- if not valid:
- version = ('', '', '')
- if not pn_regex:
- testversion = ('', '', '')
- bb.debug(3, "*** %s -> %s (TestVersion = %s)" % (package, version[1], testversion[1]))
if valid and version:
return re.sub('_', '.', version[1])
@@ -336,6 +338,11 @@ class Wget(FetchMethod):
pupver = ""
self._init_regexes(package)
+ current_version = ('', d.getVar('PV', True), '')
+
+ """possible to have no version in pkg name, such as spectrum-fw"""
+ if not re.search("\d+", package):
+ return re.sub('_', '.', current_version[1])
if not regex_uri:
# generate the new uri with the appropriate latest directory
@@ -355,12 +362,14 @@ class Wget(FetchMethod):
# generate the new uri with the appropriate latest directory
newuri = regex_uri or bb.fetch.encodeurl([ud.type, ud.host, newpath, ud.user, ud.pswd, {}])
- newversion = self._check_latest_version(newuri, package, ud, d)
+ newversion = self._check_latest_version(newuri, package,
+ current_version, ud, d)
while not newversion:
# maybe it's hiding in a download directory so try there
newuri = "/".join(newuri.split("/")[0:-2]) + "/download"
if newuri == "/download" or newuri == "http://download":
break
- newversion = self._check_latest_version(newuri, package, ud, d)
+ newversion = self._check_latest_version(newuri, package,
+ current_version, ud, d)
return newversion or ""
OpenPOWER on IntegriCloud