[Yum-devel] [PATCH 2/3] Treat square brackets same way in re_full_search_needed and refineSearchPattern as in re_glob.
ville.skytta at iki.fi
Wed Oct 28 19:49:23 UTC 2009
On Wednesday 28 October 2009, James Antill wrote:
> 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.
I _think_ the final "." before the "$" does have some value, so instead of
replacing it with ".*" it could be replaced with ".". If a search string has
only one of these matching chars/constructs and it is at end of the string
(think "foo*", "foo-", "foo."), we know that it would match against name only
or it won't match any N-V-R.A or a N.A (the "foo-" and "foo." cases), so
there's no need to trigger full searches for those cases. Requiring something
after them (the ".") AFAICT accomplishes that.
> Also please keep the comments aligned (hey, be happy you don't have to
> live with me ;)
I have one more patch coming up that addresses all of the above - in this one
I wanted to keep changes in the bare minimum.
More information about the Yum-devel