From 35b7089b34313d3cba57bcfbb4eeb0600578d26f Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Thu, 27 Nov 2014 19:12:01 -0600 Subject: bitbake: fetch/wget: latest_versionstring create _init_regex method for have one place when regex'es are defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Bitbake rev: 6989193a875afd0b1f0f88c95e28cb81bfdb4eaf) Signed-off-by: Aníbal Limón Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/wget.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index db5f27b6f1..687d494fd5 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -273,12 +273,9 @@ class Wget(FetchMethod): if valid and version: return re.sub('_', '.', version[1]) - def latest_versionstring(self, ud, d): + def _init_regexes(self): """ - Manipulate the URL and try to obtain the latest package version - - sanity check to ensure same name and type. Match as many patterns as possible - such as: + Match as many patterns as possible such as: gnome-common-2.20.0.tar.gz (most common format) gtk+-2.90.1.tar.gz xf86-input-synaptics-12.6.9.tar.gz @@ -310,10 +307,18 @@ class Wget(FetchMethod): # match name, version and archive type of a package self.name_version_type_regex = re.compile("(?P%s?)\.?v?(?P%s)(\-source)?[\.\-](?P%s$)" % (self.pn_regex, version_regex, suffixlist)) + def latest_versionstring(self, ud, d): + """ + Manipulate the URL and try to obtain the latest package version + + sanity check to ensure same name and type. + """ regex_uri = d.getVar("REGEX_URI", True) newpath = ud.path pupver = "" + self._init_regexes() + # 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 m = re.search("(?P[^/]*(\d+\.)*\d+([\-_]r\d+)*)/", ud.path) -- cgit v1.2.3-54-g00ecf