summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2014-11-27 19:12:02 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-28 14:03:00 +0000
commita7bdd0eb295f80b0f42750f6cfd32ae5757c12c9 (patch)
treee1c851d0e92eec8a47f83610f0933e0e3e4d2665 /bitbake/lib/bb/fetch2
parent35b7089b34313d3cba57bcfbb4eeb0600578d26f (diff)
downloadpoky-a7bdd0eb295f80b0f42750f6cfd32ae5757c12c9.tar.gz
bitbake: fetch/wget: _init_regexes rename variables to be more consistent and move dirver_regex into it
(Bitbake rev: 583e5d9c1c3cb8a25d34648078200faadc597e9c) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 687d494fd5..b6b1339d8d 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -151,7 +151,7 @@ class Wget(FetchMethod):
151 Check for a new suffix type that we have never heard of before 151 Check for a new suffix type that we have never heard of before
152 """ 152 """
153 if (newsuffix): 153 if (newsuffix):
154 m = self.suffixregex.search(newsuffix) 154 m = self.suffix_regex_comp.search(newsuffix)
155 if not m: 155 if not m:
156 bb.warn("%s has a possible unknown suffix: %s" % (newpn, newsuffix)) 156 bb.warn("%s has a possible unknown suffix: %s" % (newpn, newsuffix))
157 return False 157 return False
@@ -233,7 +233,7 @@ class Wget(FetchMethod):
233 If error or no version, return "" 233 If error or no version, return ""
234 """ 234 """
235 valid = 0 235 valid = 0
236 version = self._parse_path(self.name_version_type_regex, packagename) 236 version = self._parse_path(self.package_regex_comp, packagename)
237 237
238 bb.debug(3, "VersionURL: %s" % (url)) 238 bb.debug(3, "VersionURL: %s" % (url))
239 soup = BeautifulSoup(self._fetch_index(url, ud, d)) 239 soup = BeautifulSoup(self._fetch_index(url, ud, d))
@@ -258,7 +258,7 @@ class Wget(FetchMethod):
258 else: 258 else:
259 continue 259 continue
260 else: 260 else:
261 newver = self._parse_path(self.name_version_type_regex, line['href']) 261 newver = self._parse_path(self.package_regex_comp, line['href'])
262 valid = 1 262 valid = 1
263 if newver and self._vercmp(version, newver) == True: 263 if newver and self._vercmp(version, newver) == True:
264 version = newver 264 version = newver
@@ -294,18 +294,26 @@ class Wget(FetchMethod):
294 # a loose pattern such as for 80325-quicky-0.4.tar.gz 294 # a loose pattern such as for 80325-quicky-0.4.tar.gz
295 pn_prefix3 = "[0-9]+[\-]?[a-zA-Z]+" 295 pn_prefix3 = "[0-9]+[\-]?[a-zA-Z]+"
296 # Save the Package Name (pn) Regex for use later 296 # Save the Package Name (pn) Regex for use later
297 self.pn_regex = "(%s|%s|%s)" % (pn_prefix1, pn_prefix2, pn_prefix3) 297 pn_regex = "(%s|%s|%s)" % (pn_prefix1, pn_prefix2, pn_prefix3)
298 298
299 # match version 299 # match version
300 version_regex = "(([A-Z]*\d+[a-zA-Z]*[\.\-_]*)+)" 300 pver_regex = "(([A-Z]*\d+[a-zA-Z]*[\.\-_]*)+)"
301
302 # match arch
303 parch_regex = "\-source|_all_"
301 304
302 # src.rpm extension was added only for rpm package. Can be removed if the rpm 305 # src.rpm extension was added only for rpm package. Can be removed if the rpm
303 # packaged will always be considered as having to be manually upgraded 306 # packaged will always be considered as having to be manually upgraded
304 suffixlist = "(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)" 307 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)"
305 self.suffixregex = re.compile(suffixlist)
306 308
307 # match name, version and archive type of a package 309 # match name, version and archive type of a package
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)) 310 self.package_regex_comp = re.compile("(?P<name>%s?)\.?v?(?P<ver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)"
311 % (pn_regex, pver_regex, parch_regex, psuffix_regex))
312 self.suffix_regex_comp = re.compile(psuffix_regex)
313
314 # search for version matches on folders inside the path, like:
315 # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
316 self.dirver_regex_comp = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/")
309 317
310 def latest_versionstring(self, ud, d): 318 def latest_versionstring(self, ud, d):
311 """ 319 """
@@ -319,11 +327,9 @@ class Wget(FetchMethod):
319 327
320 self._init_regexes() 328 self._init_regexes()
321 329
322 # search for version matches on folders inside the path, like: 330 m = self.dirver_regex_comp.search(ud.path)
323 # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
324 m = re.search("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/", ud.path)
325 bb.debug(3, "path = %s" % (ud.path)) 331 bb.debug(3, "path = %s" % (ud.path))
326 bb.debug(3, "Regex: %s" % (self.name_version_type_regex.pattern)) 332 bb.debug(3, "Regex: %s" % (self.package_regex_comp.pattern))
327 if m and not regex_uri: 333 if m and not regex_uri:
328 dirver = m.group('dirver') 334 dirver = m.group('dirver')
329 # generate the new uri after removing version directory name 335 # generate the new uri after removing version directory name