[Yum-devel] [PATCH 2/5] Split the SQL part of _buildPkgObjList() into a separate function

James Antill james at and.org
Mon Aug 17 15:33:37 UTC 2009


---
 yum/sqlitesack.py |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 277ca8c..843cf81 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1473,16 +1473,9 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
         return (need_full, patterns, False)
 
     @catchSqliteException
-    def _buildPkgObjList(self, repoid=None, patterns=None, ignore_case=False):
-        """Builds a list of packages, only containing nevra information. No
-           excludes are done at this stage. """
-
-        returnList = []
-
-        (need_full, patterns, names) = self._setupPkgObjList(repoid, patterns,
-                                                             ignore_case)
-        if names:
-            return self.searchNames(patterns)
+    def _yieldSQLDataList(self, repoid=None, patterns=None, ignore_case=False):
+        """Yields all the package data for the given params. Excludes are done
+           at this stage. """
 
         for (repo,cache) in self.primarydb.items():
             if (repoid == None or repoid == repo.id):
@@ -1506,6 +1499,20 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
                 #  Note: If we are building the pkgobjlist, we don't exclude
                 # here, so that we can un-exclude later on ... if that matters.
                 for x in cur:
+                    yield (repo, x)
+
+    def _buildPkgObjList(self, repoid=None, patterns=None, ignore_case=False):
+        """Builds a list of packages, only containing nevra information. No
+           excludes are done at this stage. """
+
+        returnList = []
+
+        (need_full, patterns, names) = self._setupPkgObjList(repoid, patterns,
+                                                             ignore_case)
+        if names:
+            return self.searchNames(patterns)
+
+        for (repo, x) in self._yieldSQLDataList(repoid, patterns, ignore_case):
                     exclude = not patterns
                     if True: # NOTE: Can't unexclude things...
                         exclude = True
-- 
1.6.2.5



More information about the Yum-devel mailing list