[bitbake-devel] [PATCH 03/12] fetch2/wget.py: latest_versionstring create _init_regex method for have one place when regex'es are defined

Aníbal Limón anibal.limon at linux.intel.com
Fri Nov 28 01:12:01 UTC 2014


Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 bitbake/lib/bb/fetch2/wget.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index db5f27b..687d494 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<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)
-- 
1.9.1




More information about the bitbake-devel mailing list