[yum-cvs] yum/yum __init__.py,1.302,1.303 sqlitesack.py,1.80,1.81

James Bowes jbowes at linux.duke.edu
Sun Mar 4 18:48:47 UTC 2007


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv20654/yum

Modified Files:
	__init__.py sqlitesack.py 
Log Message:
For the yum provides command, don't return packages by dep first, as this is
covered by searchAll (with the addition of /bin etc file search). Also, unique
the results from searchAll.


Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -r1.302 -r1.303
--- __init__.py	4 Mar 2007 15:43:12 -0000	1.302
+++ __init__.py	4 Mar 2007 18:48:44 -0000	1.303
@@ -1226,27 +1226,18 @@
     def searchPackageProvides(self, args, callback=None):
         
         matches = {}
-        
-        # search deps the simple way first
-        for arg in args:
-            self.verbose_logger.log(logginglevels.DEBUG_1, 'searching the simple way')
-            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
         self.verbose_logger.log(logginglevels.DEBUG_1,
             'fully populating the necessary data')
         for arg in args:
-            matched = 0
+            matched = False
             globs = ['.*bin\/.*', '.*\/etc\/.*', '^\/usr\/lib\/sendmail$']
             for glob in globs:
                 globc = re.compile(glob)
                 if globc.match(arg):
-                    matched = 1
+                    matched = True
             if not matched:
                 self.doSackFilelistPopulate()
 

Index: sqlitesack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- sqlitesack.py	4 Mar 2007 16:32:16 -0000	1.80
+++ sqlitesack.py	4 Mar 2007 18:48:44 -0000	1.81
@@ -276,6 +276,14 @@
                 pkg = self.getPackageDetails(ob['pkgId'])
                 result.append((self.pc(rep,pkg)))
 
+            cur = cache.cursor()
+            executeSQL(cur, "select DISTINCT packages.pkgId as pkgId from files,packages where files.name LIKE ? and files.pkgKey = packages.pkgKey", ("%%%s%%" % name,))
+            for ob in cur.fetchall():
+                if self._excluded(rep,ob['pkgId']):
+                    continue
+                pkg = self.getPackageDetails(ob['pkgId'])
+                result.append(self.pc(rep,pkg))
+
         for (rep,cache) in self.filelistsdb.items():
             cur = cache.cursor()
             (dirname,filename) = os.path.split(name)
@@ -310,8 +318,9 @@
                 pkg = self.getPackageDetails(ob['pkgId'])
                 result.append((self.pc(rep,pkg)))
 
+        result = misc.unique(result)
         return result
-    
+
     def searchFiles(self, name):
         """search primary if file will be in there, if not, search filelists, use globs, if possible"""
         




More information about the Yum-cvs-commits mailing list