[yum-commits] Branch 'yum-3_2_X' - yum/rpmsack.py

James Antill james at osuosl.org
Thu Oct 7 18:17:23 UTC 2010


 yum/rpmsack.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit f48cd622045f0d39bf21307d721d45d0d3018a3b
Author: James Antill <james at and.org>
Date:   Mon Oct 4 15:36:18 2010 -0400

     Speedup rpmdb.pkglist, roughly .35 of a second to .02.
    
     This is roughly 15-20% of "list updates" time. Dito. yumex.
    
     We won't save any time here for an actual transaction, because we need
    to load the packages anyway. We could convert this data into packages,
    with more work ... and that might be worth it, but it's significantly
    bigger.

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 52e771b..1f44706 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -204,6 +204,11 @@ class RPMDBPackageSack(PackageSackBase):
         Returns a list of package tuples.
         '''
         if not self._simple_pkgtup_list:
+            csumpkgtups = self.preloadPackageChecksums(load_packages=False)
+            if csumpkgtups is not None:
+                self._simple_pkgtup_list = csumpkgtups.keys()
+
+        if not self._simple_pkgtup_list:
             for (hdr, mi) in self._all_packages():
                 self._simple_pkgtup_list.append(self._hdr2pkgTuple(hdr))
             
@@ -880,7 +885,7 @@ class RPMDBPackageSack(PackageSackBase):
         os.rename(self._cachedir + '/file-requires.tmp',
                   self._cachedir + '/file-requires')
 
-    def preloadPackageChecksums(self):
+    def preloadPackageChecksums(self, load_packages=True):
         """ As simpleVersion() et. al. requires it, we "cache" this yumdb data
             as part of our rpmdb cache. We cache it with rpmdb data, even
             though someone _could_ use yumdb to alter it without changing the
@@ -922,6 +927,9 @@ class RPMDBPackageSack(PackageSackBase):
             self._deal_with_bad_rpmdbcache("pkg checksums")
             return
 
+        if not load_packages:
+             return checksum_data
+
         for pkgtup in checksum_data:
             (n, a, e, v, r) = pkgtup
             pkg = self.searchNevra(n, e, v, r, a)


More information about the Yum-commits mailing list