summaryrefslogtreecommitdiffstats
path: root/bitbake
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
parentaf47f14c71026fb07ecb1342e5e0e1ef8bd0a2e5 (diff)
downloadpoky-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')
-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 1a585a5743..7e4f4323e2 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -227,18 +227,18 @@ class Wget(FetchMethod):
227 bb.debug(3, "Not Valid") 227 bb.debug(3, "Not Valid")
228 return None 228 return None
229 229
230 def _check_latest_version(self, url, package, ud, d): 230 def _check_latest_version(self, url, package, current_version, ud, d):
231 """ 231 """
232 Return the latest version of a package inside a given directory path 232 Return the latest version of a package inside a given directory path
233 If error or no version, return "" 233 If error or no version, return ""
234 """ 234 """
235 valid = 0 235 valid = 0
236 version = self._parse_path(self.package_custom_regex_comp, package) 236 version = ('', '', '')
237 237
238 bb.debug(3, "VersionURL: %s" % (url)) 238 bb.debug(3, "VersionURL: %s" % (url))
239 soup = BeautifulSoup(self._fetch_index(url, ud, d)) 239 soup = BeautifulSoup(self._fetch_index(url, ud, d))
240 if not soup: 240 if not soup:
241 bb.debug(3, "*** %s NO SOUP" % (package)) 241 bb.debug(3, "*** %s NO SOUP" % (url))
242 return None 242 return None
243 243
244 pn_regex = d.getVar('REGEX', True) 244 pn_regex = d.getVar('REGEX', True)
@@ -248,7 +248,7 @@ class Wget(FetchMethod):
248 bb.debug(3, "pn_regex = '%s'" % (pn_regex.pattern)) 248 bb.debug(3, "pn_regex = '%s'" % (pn_regex.pattern))
249 249
250 for line in soup.find_all('a', href=True): 250 for line in soup.find_all('a', href=True):
251 newver = ('', '', '') 251 newver = None
252 bb.debug(3, "line = '%s'" % (line['href'])) 252 bb.debug(3, "line = '%s'" % (line['href']))
253 if pn_regex: 253 if pn_regex:
254 m = pn_regex.search(line['href']) 254 m = pn_regex.search(line['href'])
@@ -259,17 +259,19 @@ class Wget(FetchMethod):
259 continue 259 continue
260 else: 260 else:
261 newver = self._parse_path(self.package_custom_regex_comp, line['href']) 261 newver = self._parse_path(self.package_custom_regex_comp, line['href'])
262 valid = 1 262
263 if newver and self._vercmp(version, newver) == True: 263 if newver:
264 version = newver 264 bb.debug(3, "Upstream version found: %s" % newver[1])
265 if valid == 0:
266 version = newver
267 valid = 1
268 elif self._vercmp(version, newver) == True:
269 version = newver
265 270
266 # check whether a valid package and version were found 271 # check whether a valid package and version were found
272 bb.debug(3, "*** %s -> UpstreamVersion = %s (CurrentVersion = %s)" %
273 (package, version[1] or "N/A", current_version[1]))
267 274
268 if not valid:
269 version = ('', '', '')
270 if not pn_regex:
271 testversion = ('', '', '')
272 bb.debug(3, "*** %s -> %s (TestVersion = %s)" % (package, version[1], testversion[1]))
273 if valid and version: 275 if valid and version:
274 return re.sub('_', '.', version[1]) 276 return re.sub('_', '.', version[1])
275 277
@@ -336,6 +338,11 @@ class Wget(FetchMethod):
336 pupver = "" 338 pupver = ""
337 339
338 self._init_regexes(package) 340 self._init_regexes(package)
341 current_version = ('', d.getVar('PV', True), '')
342
343 """possible to have no version in pkg name, such as spectrum-fw"""
344 if not re.search("\d+", package):
345 return re.sub('_', '.', current_version[1])
339 346
340 if not regex_uri: 347 if not regex_uri:
341 # generate the new uri with the appropriate latest directory 348 # generate the new uri with the appropriate latest directory
@@ -355,12 +362,14 @@ class Wget(FetchMethod):
355 362
356 # generate the new uri with the appropriate latest directory 363 # generate the new uri with the appropriate latest directory
357 newuri = regex_uri or bb.fetch.encodeurl([ud.type, ud.host, newpath, ud.user, ud.pswd, {}]) 364 newuri = regex_uri or bb.fetch.encodeurl([ud.type, ud.host, newpath, ud.user, ud.pswd, {}])
358 newversion = self._check_latest_version(newuri, package, ud, d) 365 newversion = self._check_latest_version(newuri, package,
366 current_version, ud, d)
359 while not newversion: 367 while not newversion:
360 # maybe it's hiding in a download directory so try there 368 # maybe it's hiding in a download directory so try there
361 newuri = "/".join(newuri.split("/")[0:-2]) + "/download" 369 newuri = "/".join(newuri.split("/")[0:-2]) + "/download"
362 if newuri == "/download" or newuri == "http://download": 370 if newuri == "/download" or newuri == "http://download":
363 break 371 break
364 newversion = self._check_latest_version(newuri, package, ud, d) 372 newversion = self._check_latest_version(newuri, package,
373 current_version, ud, d)
365 374
366 return newversion or "" 375 return newversion or ""