fetch2: wget latest_versionstring improvments
cover fetch2: wget latest_versionstring improvments
The next set of changes contains:
- Add support for scan every version directory with _check_latest_version instead of get latest version directory, this add makes code more robust because sometimes upstream sites publish version directory without files causing to don't find upstream version.
- Modelate version improvments for version comparision when version contains alpha, beta, rc.
- Bugfixes and cleanup.
- Update testing.
Changes can be reviewed at:
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=alimon/bitbake-fetch-wget-latest_versionstring
Aníbal Limón (7):
fetch2: wget latest_versionstring improve _parse_path
fetch2: wget latest_versionstring _check_latest_version improvments
fetch2: wget add _check_latest_version_by_dir
fetch2: wget latest_versionstring improvments in get version by dir
fetch2: wget _modelate_version improvments
fetch2: wget remove scape of - in regexes don't needed tests/fetch.py: latest_versionstring add set of PN
lib/bb/fetch2/wget.py | 247 ++++++++++++++++++++++++++------------------------ lib/bb/tests/fetch.py | 2 + 2 files changed, 130 insertions(+), 119 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/7 fetch2: wget latest_versionstring improve _parse_path
Add support for get group only if exist in regex, this enables to use this function in _check_latestversion regardless if the regex is generic or specified by REGEX_URI.
--- lib/bb/fetch2/wget.py | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-)
lib/bb/fetch2/wget.py +24 -20
@@ -109,16 +109,30 @@ class Wget(FetchMethod): return True - def _parse_path(self, regex, s): """ Find and group name, version and archive type in the given string s """ - bb.debug(3, "parse_path(%s, %s)" % (regex.pattern, s)) + bb.debug(3, "_parse_path(%s, %s)" % (regex.pattern, s)) + m = regex.search(s) if m: - bb.debug(3, "%s, %s, %s" % (m.group('name'), m.group('ver'), m.group('type'))) - return (m.group('name'), m.group('ver'), m.group('type')) + pname = '' + pver = '' + ptype = '' + + mdict = m.groupdict() + if 'name' in mdict.keys(): + pname = mdict['name'] + if 'pver' in mdict.keys(): + pver = mdict['pver'] + if 'type' in mdict.keys(): + ptype = mdict['type'] + + bb.debug(3, "_parse_path: %s, %s, %s" % (pname, pver, ptype)) + + return (pname, pver, ptype) + return None def _modelate_version(self, version):
@@ -243,25 +257,15 @@ class Wget(FetchMethod): pn_regex = d.getVar('REGEX', True) if pn_regex: pn_regex = re.compile(pn_regex) + package_regex = pn_regex bb.debug(3, "pn_regex = '%s'" % (pn_regex.pattern)) for line in soup.find_all('a', href=True): newver = None bb.debug(3, "line = '%s'" % (line['href'])) - if pn_regex: - m = pn_regex.search(line['href']) - if m: - bb.debug(3, "Pver = '%s'" % (m.group('pver'))) - newver = ('', m.group('pver'), '') - else: - m = pn_regex.search(str(line)) - if m: - bb.debug(3, "Pver = '%s'" % (m.group('pver'))) - newver = ('', m.group('pver'), '') - else: - newver = self._parse_path(package_regex, line['href']) - if not newver: - newver = self._parse_path(package_regex, str(line)) + newver = self._parse_path(package_regex, line['href']) + if not newver: + newver = self._parse_path(package_regex, str(line)) if newver: bb.debug(3, "Upstream version found: %s" % newver[1])
@@ -314,7 +318,7 @@ class Wget(FetchMethod): psuffix_regex = "(tar\.gz|tgz|tar\.bz2|zip|xz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)" # match name, version and archive type of a package - self.package_regex_comp = re.compile("(?P<name>%s?)\.?v?(?P<ver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)" + self.package_regex_comp = re.compile("(?P<name>%s?)\.?v?(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)" % (pn_regex, pver_regex, parch_regex, psuffix_regex)) self.suffix_regex_comp = re.compile(psuffix_regex)
@@ -327,7 +331,7 @@ class Wget(FetchMethod): version = self._parse_path(self.package_regex_comp, package) if version: package_custom_regex_comp = re.compile( - "(?P<name>%s)(?P<ver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" % + "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" % (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex)) return package_custom_regex_comp
Signature · 1 line
1.9.1
PATCH 2/7 fetch2: wget latest_versionstring _check_latest_version improvments
In reply to Aníbal LimónIn order to reduce code duplication now compile package_regex in _init_regexes instead of make this decision at _check_latest_version,
--- lib/bb/fetch2/wget.py | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-)
lib/bb/fetch2/wget.py +25 -26
@@ -243,26 +243,21 @@ class Wget(FetchMethod): 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 + If error or no version, return "" """ valid = 0 - version = ('', '', '') + version = ['', '', ''] bb.debug(3, "VersionURL: %s" % (url)) soup = BeautifulSoup(self._fetch_index(url, ud, d)) if not soup: bb.debug(3, "*** %s NO SOUP" % (url)) - return None + return "" - pn_regex = d.getVar('REGEX', True) - if pn_regex: - pn_regex = re.compile(pn_regex) - package_regex = pn_regex - bb.debug(3, "pn_regex = '%s'" % (pn_regex.pattern)) - for line in soup.find_all('a', href=True): - newver = None - bb.debug(3, "line = '%s'" % (line['href'])) + bb.debug(3, "line = '%s'" % (str(line))) + bb.debug(3, "line['href'] = '%s'" % (line['href'])) + newver = self._parse_path(package_regex, line['href']) if not newver: newver = self._parse_path(package_regex, str(line))
@@ -279,12 +274,12 @@ class Wget(FetchMethod): bb.debug(3, "*** %s -> UpstreamVersion = %s (CurrentVersion = %s)" % (package, version[1] or "N/A", current_version[1])) - if valid and version: + if valid: return re.sub('_', '.', version[1]) - return None + return "" - def _init_regexes(self, package): + def _init_regexes(self, package, ud, d): """ Match as many patterns as possible such as: gnome-common-2.20.0.tar.gz (most common format)
@@ -318,7 +313,7 @@ class Wget(FetchMethod): psuffix_regex = "(tar\.gz|tgz|tar\.bz2|zip|xz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)" # match name, version and archive type of a package - self.package_regex_comp = re.compile("(?P<name>%s?)\.?v?(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)" + package_regex_comp = re.compile("(?P<name>%s?)\.?v?(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)" % (pn_regex, pver_regex, parch_regex, psuffix_regex)) self.suffix_regex_comp = re.compile(psuffix_regex)
@@ -326,13 +321,18 @@ 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<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") - # make custom regex for search in uri's - package_custom_regex_comp = None - version = self._parse_path(self.package_regex_comp, package) - if version: - package_custom_regex_comp = re.compile( - "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" % - (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex)) + # compile regex, can be specific by package or generic regex + pn_regex = d.getVar('REGEX', True) + if pn_regex: + package_custom_regex_comp = re.compile(pn_regex) + else: + version = self._parse_path(package_regex_comp, package) + if version: + package_custom_regex_comp = re.compile( + "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" % + (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex)) + else: + package_custom_regex_comp = package_regex_comp return package_custom_regex_comp
@@ -347,7 +347,7 @@ class Wget(FetchMethod): newpath = regex_uri or ud.path pupver = "" - package_custom_regex_comp = self._init_regexes(package) + package_regex = self._init_regexes(package, ud, d) current_version = ('', d.getVar('PV', True), '')
@@ -371,6 +371,5 @@ class Wget(FetchMethod): else: newuri = newpath - return self._check_latest_version(newuri, package, - package_custom_regex_comp or package_regex_comp, - current_version, ud, d) or "" + return self._check_latest_version(newuri, package, package_regex, + current_version, ud, d)
Signature · 1 line
1.9.1
PATCH 3/7 fetch2: wget add _check_latest_version_by_dir
In reply to Aníbal LimónAdd _check_latest_version_by_dir this function provides support for scan every directory newer than current dir in order to get latest_versionstring, example:
http://somedoamin.com/project/v2.1/ http://somedoamin.com/project/v3.0/
Change return of _vercmp from True/False to -1/0/1 to provide test when current directory is equal to newer directory this helps to scan the same directory to get minor versions, example:
http://somedoamin.com/project/v2.1/project-v2.1.2.tgz http://somedoamin.com/project/v2.1/project-v2.1.6.tgz
--- lib/bb/fetch2/wget.py | 52 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-)
lib/bb/fetch2/wget.py +46 -6
@@ -179,10 +179,7 @@ class Wget(FetchMethod): oldpv = self._modelate_version(oldpv) newpv = self._modelate_version(newpv) - if bb.utils.vercmp(("0", oldpv, ""), ("0", newpv, "")) < 0: - return True - else: - return False + return bb.utils.vercmp(("0", oldpv, ""), ("0", newpv, "")) def _fetch_index(self, uri, ud, d): """
@@ -230,7 +227,7 @@ class Wget(FetchMethod): m = regex.search(href['href'].strip("/")) if m: thisversion = ('', m.group(2), '') - if thisversion and self._vercmp(version, thisversion) == True: + if thisversion and self._vercmp(version, thisversion) < 0: version = thisversion if valid:
@@ -267,7 +264,7 @@ class Wget(FetchMethod): if valid == 0: version = newver valid = 1 - elif self._vercmp(version, newver) == True: + elif self._vercmp(version, newver) < 0: version = newver # check whether a valid package and version were found
@@ -279,6 +276,49 @@ class Wget(FetchMethod): return "" + def _check_latest_version_by_dir(self, dirver, package, package_regex, + current_version, ud, d): + """ + Scan every directory in order to get upstream version. + """ + version_dir = ['', '', ''] + version = ['', '', ''] + + dirver_regex = re.compile("(\D*)((\d+[\.\-_])+(\d+))") + s = dirver_regex.search(dirver) + if s: + version_dir[1] = s.group(2) + else: + version_dir[1] = dirver + + dirs_uri = bb.fetch.encodeurl([ud.type, ud.host, + ud.path.split(dirver)[0], ud.user, ud.pswd, {}]) + bb.debug(3, "DirURL: %s, %s" % (dirs_uri, package)) + + soup = BeautifulSoup(self._fetch_index(dirs_uri, ud, d)) + if not soup: + return version[1] + + for line in soup.find_all('a', href=True): + s = dirver_regex.search(line['href'].strip("/")) + if s: + version_dir_new = ['', s.group(2), ''] + if self._vercmp(version_dir, version_dir_new) <= 0: + dirver_new = s.group(1) + s.group(2) + path = ud.path.replace(dirver, dirver_new, True) \ + .split(package)[0] + uri = bb.fetch.encodeurl([ud.type, ud.host, path, + ud.user, ud.pswd, {}]) + + pupver = self._check_latest_version(uri, + package, package_regex, current_version, ud, d) + if pupver: + version[1] = pupver + + version_dir = version_dir_new + + return version[1] + def _init_regexes(self, package, ud, d): """ Match as many patterns as possible such as:
Signature · 1 line
1.9.1
PATCH 4/7 fetch2: wget latest_versionstring improvments in get version by dir
In reply to Aníbal LimónAdd support for scan every version directory using _check_latest_version makes code more robust because sometimes upstream projects publish new directories without files, causing don't find version.
To support this new behaviour remove _check_latest_dir and replace for _check_latest_version_by_dir,
--- lib/bb/fetch2/wget.py | 108 +++++++++++++++++--------------------------------- 1 file changed, 37 insertions(+), 71 deletions(-)
lib/bb/fetch2/wget.py +37 -71
@@ -113,7 +113,6 @@ class Wget(FetchMethod): """ Find and group name, version and archive type in the given string s """ - bb.debug(3, "_parse_path(%s, %s)" % (regex.pattern, s)) m = regex.search(s) if m:
@@ -199,44 +198,6 @@ class Wget(FetchMethod): f.close() return fetchresult - def _check_latest_dir(self, url, versionstring, ud, d): - """ - Return the name of the directory with the greatest package version - If error or no version, return None - """ - bb.debug(3, "DirURL: %s, %s" % (url, versionstring)) - soup = BeautifulSoup(self._fetch_index(url, ud, d)) - if not soup: - return None - - valid = 0 - prefix = '' - regex = re.compile("(\D*)((\d+[\.\-_])+(\d+))") - m = regex.search(versionstring) - if m: - version = ('', m.group(2), '') - prefix = m.group(1) - bb.debug(3, "version: %s, prefix: %s" % (version, prefix)) - else: - version = ('', versionstring, '') - - for href in soup.find_all('a', href=True): - bb.debug(3, "href: %s" % (href['href'])) - if href['href'].find(versionstring) >= 0: - valid = 1 - m = regex.search(href['href'].strip("/")) - if m: - thisversion = ('', m.group(2), '') - if thisversion and self._vercmp(version, thisversion) < 0: - version = thisversion - - if valid: - bb.debug(3, "Would return %s" % (prefix+version[1])) - return prefix+version[1] - else: - bb.debug(3, "Not Valid") - return None - 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
@@ -252,8 +213,8 @@ class Wget(FetchMethod): return "" for line in soup.find_all('a', href=True): - bb.debug(3, "line = '%s'" % (str(line))) bb.debug(3, "line['href'] = '%s'" % (line['href'])) + bb.debug(3, "line = '%s'" % (str(line))) newver = self._parse_path(package_regex, line['href']) if not newver:
@@ -267,12 +228,13 @@ class Wget(FetchMethod): elif self._vercmp(version, newver) < 0: version = newver - # check whether a valid package and version were found + pupver = re.sub('_', '.', version[1]) + bb.debug(3, "*** %s -> UpstreamVersion = %s (CurrentVersion = %s)" % - (package, version[1] or "N/A", current_version[1])) + (package, pupver or "N/A", current_version[1])) if valid: - return re.sub('_', '.', version[1]) + return pupver return ""
@@ -353,14 +315,10 @@ class Wget(FetchMethod): psuffix_regex = "(tar\.gz|tgz|tar\.bz2|zip|xz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)" # match name, version and archive type of a package - package_regex_comp = re.compile("(?P<name>%s?)\.?v?(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)" + package_regex_comp = re.compile("(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)" % (pn_regex, pver_regex, parch_regex, psuffix_regex)) self.suffix_regex_comp = re.compile(psuffix_regex) - # search for version matches on folders inside the path, like: - # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz - self.dirver_regex_comp = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") - # compile regex, can be specific by package or generic regex pn_regex = d.getVar('REGEX', True) if pn_regex:
@@ -369,10 +327,10 @@ class Wget(FetchMethod): version = self._parse_path(package_regex_comp, package) if version: package_custom_regex_comp = re.compile( - "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" % + "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)" % (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex)) else: - package_custom_regex_comp = package_regex_comp + package_custom_regex_comp = None return package_custom_regex_comp
@@ -383,33 +341,41 @@ class Wget(FetchMethod): sanity check to ensure same name and type. """ package = ud.path.split("/")[-1] - regex_uri = d.getVar("REGEX_URI", True) - newpath = regex_uri or ud.path - pupver = "" - - package_regex = self._init_regexes(package, ud, d) - - current_version = ('', d.getVar('PV', True), '') + 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]) + current_version[1] = re.sub('_', '.', current_version[1]) + current_version[1] = re.sub('-', '.', current_version[1]) + return current_version[1] + package_regex = self._init_regexes(package, ud, d) + if package_regex is None: + bb.warn("latest_versionstring: package %s don't match pattern" % (package)) + return "" + bb.debug(3, "latest_versionstring, regex: %s" % (package_regex.pattern)) + + uri = "" + regex_uri = d.getVar("REGEX_URI", True) if not regex_uri: - # generate the new uri with the appropriate latest directory - m = self.dirver_regex_comp.search(ud.path) + path = ud.path.split(package)[0] + + # search for version matches on folders inside the path, like: + # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz + dirver_regex = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") + m = dirver_regex.search(path) if m: + pn = d.getVar('PN', True) dirver = m.group('dirver') - newuri = bb.fetch.encodeurl([ud.type, ud.host, - ud.path.split(dirver)[0], ud.user, ud.pswd, {}]) - new_dirver = self._check_latest_dir(newuri, dirver, ud, d) - if new_dirver and dirver != new_dirver: - newpath = ud.path.replace(dirver, new_dirver, True) - - newpath = newpath.split(package)[0] or "/" # path to directory - newuri = bb.fetch.encodeurl([ud.type, ud.host, newpath, ud.user, ud.pswd, {}]) + + dirver_pn_regex = re.compile("%s\d?" % (re.escape(pn))) + if not dirver_pn_regex.search(dirver): + return self._check_latest_version_by_dir(dirver, + package, package_regex, current_version, ud, d) + + uri = bb.fetch.encodeurl([ud.type, ud.host, path, ud.user, ud.pswd, {}]) else: - newuri = newpath + uri = regex_uri - return self._check_latest_version(newuri, package, package_regex, - current_version, ud, d) + return self._check_latest_version(uri, package, package_regex, + current_version, ud, d)
Signature · 1 line
1.9.1
PATCH 5/7 fetch2: wget _modelate_version improvments
In reply to Aníbal LimónFix sustition for rc, beta and alpha releses from -N to N weight.
--- lib/bb/fetch2/wget.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/bb/fetch2/wget.py +3 -3
@@ -143,9 +143,9 @@ class Wget(FetchMethod): version = re.sub('\-', '.', version) version = re.sub('_', '.', version) - version = re.sub('(rc)+', '.-1.', version) - version = re.sub('(alpha)+', '.-3.', version) - version = re.sub('(beta)+', '.-2.', version) + version = re.sub('(rc)+', '.1000.', version) + version = re.sub('(beta)+', '.100.', version) + version = re.sub('(alpha)+', '.10.', version) if version[0] == 'v': version = version[1:len(version)] return version
Signature · 1 line
1.9.1
PATCH 6/7 fetch2: wget remove scape of - in regexes don't needed
In reply to Aníbal Limón--- lib/bb/fetch2/wget.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
lib/bb/fetch2/wget.py +9 -9
@@ -141,7 +141,7 @@ class Wget(FetchMethod): else: version = version[1:len(version)] - version = re.sub('\-', '.', version) + version = re.sub('-', '.', version) version = re.sub('_', '.', version) version = re.sub('(rc)+', '.1000.', version) version = re.sub('(beta)+', '.100.', version)
@@ -246,7 +246,7 @@ class Wget(FetchMethod): version_dir = ['', '', ''] version = ['', '', ''] - dirver_regex = re.compile("(\D*)((\d+[\.\-_])+(\d+))") + dirver_regex = re.compile("(\D*)((\d+[\.-_])+(\d+))") s = dirver_regex.search(dirver) if s: version_dir[1] = s.group(2)
@@ -296,26 +296,26 @@ class Wget(FetchMethod): gst-fluendo-mp3 """ # match most patterns which uses "-" as separator to version digits - pn_prefix1 = "[a-zA-Z][a-zA-Z0-9]*([\-_][a-zA-Z]\w+)*\+?[\-_]" + pn_prefix1 = "[a-zA-Z][a-zA-Z0-9]*([-_][a-zA-Z]\w+)*\+?[-_]" # a loose pattern such as for unzip552.tar.gz pn_prefix2 = "[a-zA-Z]+" # a loose pattern such as for 80325-quicky-0.4.tar.gz - pn_prefix3 = "[0-9]+[\-]?[a-zA-Z]+" + pn_prefix3 = "[0-9]+[-]?[a-zA-Z]+" # Save the Package Name (pn) Regex for use later pn_regex = "(%s|%s|%s)" % (pn_prefix1, pn_prefix2, pn_prefix3) # match version - pver_regex = "(([A-Z]*\d+[a-zA-Z]*[\.\-_]*)+)" + pver_regex = "(([A-Z]*\d+[a-zA-Z]*[\.-_]*)+)" # match arch - parch_regex = "\-source|_all_" + parch_regex = "-source|_all_" # src.rpm extension was added only for rpm package. Can be removed if the rpm # packaged will always be considered as having to be manually upgraded psuffix_regex = "(tar\.gz|tgz|tar\.bz2|zip|xz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)" # match name, version and archive type of a package - package_regex_comp = re.compile("(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)" + package_regex_comp = re.compile("(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)" % (pn_regex, pver_regex, parch_regex, psuffix_regex)) self.suffix_regex_comp = re.compile(psuffix_regex)
@@ -327,7 +327,7 @@ class Wget(FetchMethod): version = self._parse_path(package_regex_comp, package) if version: package_custom_regex_comp = re.compile( - "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)" % + "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s)" % (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex)) else: package_custom_regex_comp = None
@@ -362,7 +362,7 @@ class Wget(FetchMethod): # search for version matches on folders inside the path, like: # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz - dirver_regex = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") + dirver_regex = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([-_]r\d+)*)/") m = dirver_regex.search(path) if m: pn = d.getVar('PN', True)
Signature · 1 line
1.9.1
PATCH 7/7 tests/fetch.py: latest_versionstring add set of PN
In reply to Aníbal LimónAdd set of PN in data because now latest_versionstring use it for validate version directory searching.
--- lib/bb/tests/fetch.py | 2 ++ 1 file changed, 2 insertions(+)
lib/bb/tests/fetch.py +2 -0
@@ -629,6 +629,7 @@ class FetchMethodTest(FetcherTest): else: def test_git_latest_versionstring(self): for k, v in self.test_git_uris.items(): + self.d.setVar("PN", k[0]) self.d.setVar("SRCREV", k[2]) self.d.setVar("GITTAGREGEX", k[3]) ud = bb.fetch2.FetchData(k[1], self.d)
@@ -638,6 +639,7 @@ class FetchMethodTest(FetcherTest): def test_wget_latest_versionstring(self): for k, v in self.test_wget_uris.items(): + self.d.setVar("PN", k[0]) self.d.setVar("REGEX_URI", k[2]) self.d.setVar("REGEX", k[3]) ud = bb.fetch2.FetchData(k[1], self.d)
Signature · 1 line
1.9.1