From 8c906632e718ac5a95a0cd1f2f41ff1022249761 Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Thu, 18 Dec 2014 17:58:57 -0600 Subject: bitbake: bb/fetch2/wget.py: latest_versionstring fix multithread and remove deprecated code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to fix multithread usage of latest_versionstring moves package_custom_regex_comp from class to method level because need to be defined by package. Remove code for build url's with /download suffix because it's deprecated since you can specify the download directory using package_regex.inc file. (Bitbake rev: 231cae9f9b552ec6737795c098d1de426b5adcbc) Signed-off-by: Aníbal Limón Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/wget.py | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'bitbake/lib') 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): bb.debug(3, "Not Valid") return None - def _check_latest_version(self, url, package, current_version, ud, d): + def _check_latest_version(self, url, package, package_regex, current_version, ud, d): """ Return the latest version of a package inside a given directory path If error or no version, return None @@ -260,9 +260,9 @@ class Wget(FetchMethod): bb.debug(3, "Pver = '%s'" % (m.group('pver'))) newver = ('', m.group('pver'), '') else: - newver = self._parse_path(self.package_custom_regex_comp, line['href']) + newver = self._parse_path(package_regex, line['href']) if not newver: - newver = self._parse_path(self.package_custom_regex_comp, str(line)) + newver = self._parse_path(package_regex, str(line)) if newver: bb.debug(3, "Upstream version found: %s" % newver[1]) @@ -323,13 +323,16 @@ class Wget(FetchMethod): # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz self.dirver_regex_comp = re.compile("(?P[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") - # get current version and make custom regex for search in uri's + # make custom regex for search in uri's + package_custom_regex_comp = None version = self._parse_path(self.package_regex_comp, package) if version: - self.package_custom_regex_comp = re.compile( + package_custom_regex_comp = re.compile( "(?P%s)(?P%s)(?P%s)?[\.\-](?P%s)$" % (version[0], pver_regex, parch_regex, psuffix_regex)) + return package_custom_regex_comp + def latest_versionstring(self, ud, d): """ Manipulate the URL and try to obtain the latest package version @@ -341,7 +344,8 @@ class Wget(FetchMethod): newpath = regex_uri or ud.path pupver = "" - self._init_regexes(package) + package_custom_regex_comp = self._init_regexes(package) + current_version = ('', d.getVar('PV', True), '') """possible to have no version in pkg name, such as spectrum-fw""" @@ -364,14 +368,6 @@ class Wget(FetchMethod): else: newuri = newpath - 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, - current_version, ud, d) - - return newversion or "" + return self._check_latest_version(newuri, package, + package_custom_regex_comp or package_regex_comp, + current_version, ud, d) or "" -- cgit v1.2.3-54-g00ecf