summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2014-11-27 19:12:01 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-28 14:03:00 +0000
commit35b7089b34313d3cba57bcfbb4eeb0600578d26f (patch)
tree522a3f2748bc1fe5b6b252d52827c34cae65489a
parent6cecdd1f363bf0b2b2b681ecb5e3ef226be774b9 (diff)
downloadpoky-35b7089b34313d3cba57bcfbb4eeb0600578d26f.tar.gz
bitbake: fetch/wget: latest_versionstring create _init_regex method for have one place when regex'es are defined
(Bitbake rev: 6989193a875afd0b1f0f88c95e28cb81bfdb4eaf) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/wget.py15
1 files changed, 10 insertions, 5 deletions
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):
273 if valid and version: 273 if valid and version:
274 return re.sub('_', '.', version[1]) 274 return re.sub('_', '.', version[1])
275 275
276 def latest_versionstring(self, ud, d): 276 def _init_regexes(self):
277 """ 277 """
278 Manipulate the URL and try to obtain the latest package version 278 Match as many patterns as possible such as:
279
280 sanity check to ensure same name and type. Match as many patterns as possible
281 such as:
282 gnome-common-2.20.0.tar.gz (most common format) 279 gnome-common-2.20.0.tar.gz (most common format)
283 gtk+-2.90.1.tar.gz 280 gtk+-2.90.1.tar.gz
284 xf86-input-synaptics-12.6.9.tar.gz 281 xf86-input-synaptics-12.6.9.tar.gz
@@ -310,10 +307,18 @@ class Wget(FetchMethod):
310 # match name, version and archive type of a package 307 # match name, version and archive type of a package
311 self.name_version_type_regex = re.compile("(?P<name>%s?)\.?v?(?P<ver>%s)(\-source)?[\.\-](?P<type>%s$)" % (self.pn_regex, version_regex, suffixlist)) 308 self.name_version_type_regex = re.compile("(?P<name>%s?)\.?v?(?P<ver>%s)(\-source)?[\.\-](?P<type>%s$)" % (self.pn_regex, version_regex, suffixlist))
312 309
310 def latest_versionstring(self, ud, d):
311 """
312 Manipulate the URL and try to obtain the latest package version
313
314 sanity check to ensure same name and type.
315 """
313 regex_uri = d.getVar("REGEX_URI", True) 316 regex_uri = d.getVar("REGEX_URI", True)
314 newpath = ud.path 317 newpath = ud.path
315 pupver = "" 318 pupver = ""
316 319
320 self._init_regexes()
321
317 # search for version matches on folders inside the path, like: 322 # search for version matches on folders inside the path, like:
318 # "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
319 m = re.search("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/", ud.path) 324 m = re.search("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/", ud.path)