diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2014-11-27 19:12:04 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-11-28 14:03:01 +0000 |
commit | af47f14c71026fb07ecb1342e5e0e1ef8bd0a2e5 (patch) | |
tree | fe3840ffbadeea913acfeeabb5d36418710f4003 /bitbake | |
parent | cd40af6b1d22fafeb2e3ee5d9c85b92011ba35a7 (diff) | |
download | poky-af47f14c71026fb07ecb1342e5e0e1ef8bd0a2e5.tar.gz |
bitbake: fetch/wget: latest_versionstring add package_custom_regex_comp
package_custom_regex_comp is built with the current package name and
then used to search upstream version this reduces custom regex'es in
sites that have different packages in the same directory.
(Bitbake rev: a69d5d48c4bf9a3df3121cc4e69ba5d7e947ad8d)
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')
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 85485bfa22..1a585a5743 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
@@ -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.package_regex_comp, package) | 236 | version = self._parse_path(self.package_custom_regex_comp, package) |
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.package_regex_comp, line['href']) | 261 | newver = self._parse_path(self.package_custom_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 |
@@ -275,7 +275,7 @@ class Wget(FetchMethod): | |||
275 | 275 | ||
276 | return None | 276 | return None |
277 | 277 | ||
278 | def _init_regexes(self): | 278 | def _init_regexes(self, package): |
279 | """ | 279 | """ |
280 | Match as many patterns as possible such as: | 280 | Match as many patterns as possible such as: |
281 | gnome-common-2.20.0.tar.gz (most common format) | 281 | gnome-common-2.20.0.tar.gz (most common format) |
@@ -317,6 +317,13 @@ class Wget(FetchMethod): | |||
317 | # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz | 317 | # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz |
318 | self.dirver_regex_comp = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") | 318 | self.dirver_regex_comp = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/") |
319 | 319 | ||
320 | # get current version and make custom regex for search in uri's | ||
321 | version = self._parse_path(self.package_regex_comp, package) | ||
322 | if version: | ||
323 | self.package_custom_regex_comp = re.compile( | ||
324 | "(?P<name>%s)(?P<ver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)$" % | ||
325 | (version[0], pver_regex, parch_regex, psuffix_regex)) | ||
326 | |||
320 | def latest_versionstring(self, ud, d): | 327 | def latest_versionstring(self, ud, d): |
321 | """ | 328 | """ |
322 | Manipulate the URL and try to obtain the latest package version | 329 | Manipulate the URL and try to obtain the latest package version |
@@ -328,7 +335,7 @@ class Wget(FetchMethod): | |||
328 | newpath = regex_uri or ud.path | 335 | newpath = regex_uri or ud.path |
329 | pupver = "" | 336 | pupver = "" |
330 | 337 | ||
331 | self._init_regexes() | 338 | self._init_regexes(package) |
332 | 339 | ||
333 | if not regex_uri: | 340 | if not regex_uri: |
334 | # generate the new uri with the appropriate latest directory | 341 | # generate the new uri with the appropriate latest directory |