[yum-commits] Branch 'yum-3_2_X' - yum/misc.py

Ville Skyttä scop at osuosl.org
Wed Oct 28 19:51:35 UTC 2009


 yum/misc.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ea4d2dc8f7434b8cf55743198354bafec694a5be
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Oct 17 17:23:48 2009 +0300

    Treat square brackets same way in re_full_search_needed and refineSearchPattern as in re_glob.

diff --git a/yum/misc.py b/yum/misc.py
index 78f296c..26bbaba 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -115,7 +115,7 @@ def re_full_search_needed(s):
     """ Tests if a string needs a full nevra match, instead of just name. """
     global _re_compiled_full_match
     if _re_compiled_full_match is None:
-        one   = re.compile('.*[-.*?[\]].*.$')     # Any wildcard or - separator
+        one   = re.compile('.*([-.*?]|\[.+\]).*.$') # Any wildcard, "." or "-"
         two   = re.compile('^[0-9]+:')            # Any epoch, for envra
         _re_compiled_full_match = (one, two)
     for rec in _re_compiled_full_match:
@@ -615,7 +615,7 @@ def refineSearchPattern(arg):
     """Takes a search string from the cli for Search or Provides
        and cleans it up so it doesn't make us vomit"""
     
-    if re.search('[*[\]{}?+]', arg):
+    if re.search('[*{}?+]|\[.+\]', arg):
         restring = fnmatch.translate(arg)
     else:
         restring = re.escape(arg)


More information about the Yum-commits mailing list