[Yum-devel] [PATCH 2/3] Treat square brackets same way in re_full_search_needed and refineSearchPattern as in re_glob.

James Antill james at fedoraproject.org
Wed Oct 28 19:19:19 UTC 2009


On Wed, 2009-10-28 at 21:10 +0200, Ville Skyttä wrote:
> ---
>  yum/misc.py |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

 ACK but...

> 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 "-"

 Does anyone know what the <.*.$> is for? I'm wondering if it's just
supposed to be .* ... and thus. if .search() would be faster.

 Also please keep the comments aligned (hey, be happy you don't have to
live with me ;)

>          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-devel mailing list