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>
This commit is contained in:
Aníbal Limón 2014-11-27 19:12:01 -06:00 committed by Richard Purdie
parent 6cecdd1f36
commit 35b7089b34
1 changed files with 10 additions and 5 deletions

View File

@ -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<name>%s?)\.?v?(?P<ver>%s)(\-source)?[\.\-](?P<type>%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<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/", ud.path)