summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py30
1 files changed, 13 insertions, 17 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index d82e78cb69..2e6da48270 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -227,7 +227,7 @@ 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, current_version, ud, d): 230 def _check_latest_version(self, url, package, package_regex, 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 None 233 If error or no version, return None
@@ -260,9 +260,9 @@ class Wget(FetchMethod):
260 bb.debug(3, "Pver = '%s'" % (m.group('pver'))) 260 bb.debug(3, "Pver = '%s'" % (m.group('pver')))
261 newver = ('', m.group('pver'), '') 261 newver = ('', m.group('pver'), '')
262 else: 262 else:
263 newver = self._parse_path(self.package_custom_regex_comp, line['href']) 263 newver = self._parse_path(package_regex, line['href'])
264 if not newver: 264 if not newver:
265 newver = self._parse_path(self.package_custom_regex_comp, str(line)) 265 newver = self._parse_path(package_regex, str(line))
266 266
267 if newver: 267 if newver:
268 bb.debug(3, "Upstream version found: %s" % newver[1]) 268 bb.debug(3, "Upstream version found: %s" % newver[1])
@@ -323,13 +323,16 @@ class Wget(FetchMethod):
323 # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz 323 # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
324 self.dirver_regex_comp = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") 324 self.dirver_regex_comp = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/")
325 325
326 # get current version and make custom regex for search in uri's 326 # make custom regex for search in uri's
327 package_custom_regex_comp = None
327 version = self._parse_path(self.package_regex_comp, package) 328 version = self._parse_path(self.package_regex_comp, package)
328 if version: 329 if version:
329 self.package_custom_regex_comp = re.compile( 330 package_custom_regex_comp = re.compile(
330 "(?P<name>%s)(?P<ver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" % 331 "(?P<name>%s)(?P<ver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" %
331 (version[0], pver_regex, parch_regex, psuffix_regex)) 332 (version[0], pver_regex, parch_regex, psuffix_regex))
332 333
334 return package_custom_regex_comp
335
333 def latest_versionstring(self, ud, d): 336 def latest_versionstring(self, ud, d):
334 """ 337 """
335 Manipulate the URL and try to obtain the latest package version 338 Manipulate the URL and try to obtain the latest package version
@@ -341,7 +344,8 @@ class Wget(FetchMethod):
341 newpath = regex_uri or ud.path 344 newpath = regex_uri or ud.path
342 pupver = "" 345 pupver = ""
343 346
344 self._init_regexes(package) 347 package_custom_regex_comp = self._init_regexes(package)
348
345 current_version = ('', d.getVar('PV', True), '') 349 current_version = ('', d.getVar('PV', True), '')
346 350
347 """possible to have no version in pkg name, such as spectrum-fw""" 351 """possible to have no version in pkg name, such as spectrum-fw"""
@@ -364,14 +368,6 @@ class Wget(FetchMethod):
364 else: 368 else:
365 newuri = newpath 369 newuri = newpath
366 370
367 newversion = self._check_latest_version(newuri, package, 371 return self._check_latest_version(newuri, package,
368 current_version, ud, d) 372 package_custom_regex_comp or package_regex_comp,
369 while not newversion: 373 current_version, ud, d) or ""
370 # maybe it's hiding in a download directory so try there
371 newuri = "/".join(newuri.split("/")[0:-2]) + "/download"
372 if newuri == "/download" or newuri == "http://download":
373 break
374 newversion = self._check_latest_version(newuri, package,
375 current_version, ud, d)
376
377 return newversion or ""