[yum-cvs] yum/yum __init__.py,1.128,1.129
Seth Vidal
skvidal at login.linux.duke.edu
Sat Jul 2 08:34:01 UTC 2005
Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv21676/yum
Modified Files:
__init__.py
Log Message:
fix the 'perl(foo::bar::baz)' searching provides bug.
Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -r1.128 -r1.129
--- __init__.py 28 Jun 2005 18:24:55 -0000 1.128
+++ __init__.py 2 Jul 2005 08:33:59 -0000 1.129
@@ -982,12 +982,12 @@
def _refineSearchPattern(self, 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.match('.*[\*,\[,\],\{,\},\?,\+].*', arg):
restring = fnmatch.translate(arg)
else:
- restring = arg
-
+ restring = re.escape(arg)
+
return restring
def findDeps(self, pkgs):
@@ -1090,6 +1090,14 @@
self.doRpmDBSetup()
matches = {}
+ # search deps the simple way first
+ for arg in args:
+ pkgs = self.returnPackagesByDep(arg)
+ for po in pkgs:
+ if callback:
+ callback(po, [arg])
+ matches[po] = [arg]
+
# search pkgSack - fully populate the worthwhile metadata to search
# if it even vaguely matches
for arg in args:
@@ -1105,17 +1113,17 @@
for arg in args:
restring = self._refineSearchPattern(arg)
- try: arg_re = re.compile(restring, flags=re.I)
+ try:
+ arg_re = re.compile(restring, flags=re.I)
except sre_constants.error, e:
raise Errors.MiscError, \
- 'Search Expression: %s is an invalid Regular Expression.\n' % arg
+ 'Search Expression: %s is an invalid Regular Expression.\n' % arg
# If this is not a regular expression, only search in packages
# returned by pkgSack.searchAll
- if restring.find('*') == restring.find('?') \
- == restring.find('%') == -1 and \
+ if arg.find('*') == arg.find('?') == arg.find('%') == -1 and \
hasattr(self.pkgSack,'searchAll'):
- where = self.pkgSack.searchAll(restring)
+ where = self.pkgSack.searchAll(arg)
else:
where = self.pkgSack
More information about the Yum-cvs-commits
mailing list