Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 6/7] fetch2: wget remove scape of - in regexes don't needed
Date: Fri, 13 Feb 2015 15:58:13 -0600	[thread overview]
Message-ID: <1423864694-24940-7-git-send-email-anibal.limon@linux.intel.com> (raw)
In-Reply-To: <1423864694-24940-1-git-send-email-anibal.limon@linux.intel.com>

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

diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 570bd47..162a6bd 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -141,7 +141,7 @@ class Wget(FetchMethod):
             else:
                 version = version[1:len(version)]
 
-        version = re.sub('\-', '.', version)
+        version = re.sub('-', '.', version)
         version = re.sub('_', '.', version)
         version = re.sub('(rc)+', '.1000.', version)
         version = re.sub('(beta)+', '.100.', version)
@@ -246,7 +246,7 @@ class Wget(FetchMethod):
         version_dir = ['', '', '']
         version = ['', '', '']
 
-        dirver_regex = re.compile("(\D*)((\d+[\.\-_])+(\d+))")
+        dirver_regex = re.compile("(\D*)((\d+[\.-_])+(\d+))")
         s = dirver_regex.search(dirver)
         if s:
             version_dir[1] = s.group(2)
@@ -296,26 +296,26 @@ class Wget(FetchMethod):
                 gst-fluendo-mp3
         """
         # match most patterns which uses "-" as separator to version digits
-        pn_prefix1 = "[a-zA-Z][a-zA-Z0-9]*([\-_][a-zA-Z]\w+)*\+?[\-_]"
+        pn_prefix1 = "[a-zA-Z][a-zA-Z0-9]*([-_][a-zA-Z]\w+)*\+?[-_]"
         # a loose pattern such as for unzip552.tar.gz
         pn_prefix2 = "[a-zA-Z]+"
         # a loose pattern such as for 80325-quicky-0.4.tar.gz
-        pn_prefix3 = "[0-9]+[\-]?[a-zA-Z]+"
+        pn_prefix3 = "[0-9]+[-]?[a-zA-Z]+"
         # Save the Package Name (pn) Regex for use later
         pn_regex = "(%s|%s|%s)" % (pn_prefix1, pn_prefix2, pn_prefix3)
 
         # match version
-        pver_regex = "(([A-Z]*\d+[a-zA-Z]*[\.\-_]*)+)"
+        pver_regex = "(([A-Z]*\d+[a-zA-Z]*[\.-_]*)+)"
 
         # match arch
-        parch_regex = "\-source|_all_"
+        parch_regex = "-source|_all_"
 
         # src.rpm extension was added only for rpm package. Can be removed if the rpm
         # packaged will always be considered as having to be manually upgraded
         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)"
 
         # match name, version and archive type of a package
-        package_regex_comp = re.compile("(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s$)"
+        package_regex_comp = re.compile("(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)"
                                                     % (pn_regex, pver_regex, parch_regex, psuffix_regex))
         self.suffix_regex_comp = re.compile(psuffix_regex)
 
@@ -327,7 +327,7 @@ class Wget(FetchMethod):
             version = self._parse_path(package_regex_comp, package)
             if version:
                 package_custom_regex_comp = re.compile(
-                    "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.\-](?P<type>%s)" %
+                    "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s)" %
                     (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex))
             else:
                 package_custom_regex_comp = None
@@ -362,7 +362,7 @@ class Wget(FetchMethod):
 
             # 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
-            dirver_regex = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([\-_]r\d+)*)/")
+            dirver_regex = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([-_]r\d+)*)/")
             m = dirver_regex.search(path)
             if m:
                 pn = d.getVar('PN', True)
-- 
1.9.1



  parent reply	other threads:[~2015-02-13 21:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13 21:58 [PATCH 0/7] fetch2: wget latest_versionstring improvments Aníbal Limón
2015-02-13 21:58 ` [PATCH 1/7] fetch2: wget latest_versionstring improve _parse_path Aníbal Limón
2015-02-13 21:58 ` [PATCH 2/7] fetch2: wget latest_versionstring _check_latest_version improvments Aníbal Limón
2015-02-13 21:58 ` [PATCH 3/7] fetch2: wget add _check_latest_version_by_dir Aníbal Limón
2015-02-13 21:58 ` [PATCH 4/7] fetch2: wget latest_versionstring improvments in get version by dir Aníbal Limón
2015-02-13 21:58 ` [PATCH 5/7] fetch2: wget _modelate_version improvments Aníbal Limón
2015-02-13 21:58 ` Aníbal Limón [this message]
2015-02-13 21:58 ` [PATCH 7/7] tests/fetch.py: latest_versionstring add set of PN Aníbal Limón

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423864694-24940-7-git-send-email-anibal.limon@linux.intel.com \
    --to=anibal.limon@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox