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

James Antill james at osuosl.org
Wed May 5 06:17:21 UTC 2010

 yum/rpmsack.py |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit a079025ebb241849ba734b47607af9eb0c2ae9a3
Author: James Antill <james at and.org>
Date:   Wed May 5 02:09:58 2010 -0400

     Work around mock setting mtime on var/lib/Packages, for it's "caches".
    Somehow the Packages file gets out of sync. with yum's cache/installed
    in the mock installroot cache, but due to the mtime check we don't see
    it and thus. blow up.
     This does mean we'll blow the cache for normal use whenever ctime
    changes now ... but hopefully that shouldn't be much more often.
     We are only hitting this now due to the installroot fixes that just
    went in.

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 6a40939..b457cc9 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -847,9 +847,11 @@ class RPMDBPackageSack(PackageSackBase):
         rpmdbfname  = self.root + "/var/lib/rpm/Packages"
         if os.path.exists(rpmdbvfname) and os.path.exists(rpmdbfname):
-            # See if rpmdb has "changed" ...
+            #  See if rpmdb has "changed" ... NOTE that we need to use ctime
+            # due to mock, because it will save and restore arbitrary rpmdb's
+            # on us and will helpfully reset the mtime!
             nmtime = os.path.getmtime(rpmdbvfname)
-            omtime = os.path.getmtime(rpmdbfname)
+            omtime = os.path.getctime(rpmdbfname)
             if omtime <= nmtime:
                 rpmdbv = open(rpmdbvfname).readline()[:-1]
                 self._have_cached_rpmdbv_data  = rpmdbv

More information about the Yum-commits mailing list