[yum-commits] Branch 'yum-3_2_X' - 5 commits - yumcommands.py yum/__init__.py yum/rpmsack.py yum/transactioninfo.py

James Antill james at osuosl.org
Thu May 6 06:41:26 UTC 2010


 yum/__init__.py        |   28 +++++++++++++---------------
 yum/rpmsack.py         |   14 ++++++--------
 yum/transactioninfo.py |    9 +++++----
 yumcommands.py         |    2 +-
 4 files changed, 25 insertions(+), 28 deletions(-)

New commits:
commit 565821231c999645b74fc8a96680f8eecf0713c9
Author: James Antill <james at and.org>
Date:   Wed May 5 16:48:24 2010 -0400

    Only do any rpmdbv checks, if history_record is set

diff --git a/yum/__init__.py b/yum/__init__.py
index 550e5cc..64663cc 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1257,18 +1257,18 @@ class YumBase(depsolve.Depsolve):
                 self.run_with_package_names.add('yum-metadata-parser')
                 break
 
-        using_pkgs_pats = list(self.run_with_package_names)
-        using_pkgs = self.rpmdb.returnPackages(patterns=using_pkgs_pats)
-        rpmdbv  = self.rpmdb.simpleVersion(main_only=True)[0]
-        lastdbv = self.history.last()
-        if lastdbv is not None:
-            lastdbv = lastdbv.end_rpmdbversion
-        if lastdbv is None or rpmdbv != lastdbv:
-            txmbrs = self.tsInfo.getMembersWithState(None, TS_REMOVE_STATES)
-            ignore_pkgs = [txmbr.po for txmbr in txmbrs]
-            self._rpmdb_warn_checks(warn=lastdbv is not None,
-                                    ignore_pkgs=ignore_pkgs)
         if self.conf.history_record:
+            using_pkgs_pats = list(self.run_with_package_names)
+            using_pkgs = self.rpmdb.returnPackages(patterns=using_pkgs_pats)
+            rpmdbv  = self.rpmdb.simpleVersion(main_only=True)[0]
+            lastdbv = self.history.last()
+            if lastdbv is not None:
+                lastdbv = lastdbv.end_rpmdbversion
+            if lastdbv is None or rpmdbv != lastdbv:
+                txmbrs = self.tsInfo.getMembersWithState(None, TS_REMOVE_STATES)
+                ignore_pkgs = [txmbr.po for txmbr in txmbrs]
+                self._rpmdb_warn_checks(warn=lastdbv is not None,
+                                        ignore_pkgs=ignore_pkgs)
             self.history.beg(rpmdbv, using_pkgs, list(self.tsInfo))
 
         #  Just before we update the transaction, update what we think the
commit e6584cd2f5aee22b2b39eeeb2c312434d004ed96
Author: James Antill <james at and.org>
Date:   Wed May 5 16:22:04 2010 -0400

    Don't do rpmdb checks, in version, with no history (as it's root only now).

diff --git a/yumcommands.py b/yumcommands.py
index 05f1296..dcf72db 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1229,7 +1229,7 @@ class VersionCommand(YumCommand):
                 lastdbv = base.history.last()
                 if lastdbv is not None:
                     lastdbv = lastdbv.end_rpmdbversion
-                if lastdbv is None or data[0] != lastdbv:
+                if lastdbv is not None and data[0] != lastdbv:
                     base._rpmdb_warn_checks(warn=lastdbv is not None)
                 if vcmd not in ('group-installed', 'group-all'):
                     cols.append(("%s %s/%s" % (_("Installed:"), rel, ba),
commit eb7fb5fba6d0f2e21a34b10cc3a6c12003ebc299
Author: James Antill <james at and.org>
Date:   Wed May 5 16:00:18 2010 -0400

    Revert " Work around mock setting mtime on var/lib/Packages, for it's "caches"."
    
    This reverts commit a079025ebb241849ba734b47607af9eb0c2ae9a3.
    
     This is not needed anymore due to the path change.

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index a11c6d5..1c8bcd5 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -847,11 +847,9 @@ 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" ... 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!
+            # See if rpmdb has "changed" ...
             nmtime = os.path.getmtime(rpmdbvfname)
-            omtime = os.path.getctime(rpmdbfname)
+            omtime = os.path.getmtime(rpmdbfname)
             if omtime <= nmtime:
                 rpmdbv = open(rpmdbvfname).readline()[:-1]
                 self._have_cached_rpmdbv_data  = rpmdbv
commit 39d852d04fd1934453d07bf9d3b9fd8ef60ca9f2
Author: James Antill <james at and.org>
Date:   Wed May 5 16:00:02 2010 -0400

    Move the rpmdb cache to yum persistent storage.

diff --git a/yum/__init__.py b/yum/__init__.py
index c2313a0..550e5cc 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -490,8 +490,7 @@ class YumBase(depsolve.Depsolve):
                                     _('Reading Local RPMDB'))
             self._rpmdb = rpmsack.RPMDBPackageSack(root=self.conf.installroot,
                                                    releasever=self.conf.yumvar['releasever'],
-                                                   persistdir=self.conf.persistdir,
-                                                   cachedir=self.conf.cachedir)
+                                                   persistdir=self.conf.persistdir)
             self.verbose_logger.debug('rpmdb time: %0.3f' % (time.time() - rpmdb_st))
         return self._rpmdb
 
@@ -1923,7 +1922,7 @@ class YumBase(depsolve.Depsolve):
         return self._cleanFiles(exts, 'cachedir', 'metadata')
 
     def cleanRpmDB(self):
-        cachedir = self.conf.cachedir + "/installed/"
+        cachedir = self.conf.persistdir + "/rpmdb-indexes/"
         if not os.path.exists(cachedir):
             filelist = []
         else:
@@ -4493,7 +4492,6 @@ class YumBase(depsolve.Depsolve):
 
         cachedir += varReplace(suffix, self.conf.yumvar)
         self.repos.setCacheDir(cachedir)
-        self.rpmdb.setCacheDir(cachedir)
         self.conf.cachedir = cachedir
         return True # We got a new cache dir
 
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index b457cc9..a11c6d5 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -169,7 +169,7 @@ class RPMDBPackageSack(PackageSackBase):
         self._get_req_cache  = {}
         self._loaded_gpg_keys = False
         if cachedir is None:
-            cachedir = misc.getCacheDir()
+            cachedir = persistdir + "/rpmdb-indexes"
         self.setCacheDir(cachedir)
         if not os.path.normpath(persistdir).startswith(self.root):
             self._persistdir = root +  '/' + persistdir
@@ -233,11 +233,11 @@ class RPMDBPackageSack(PackageSackBase):
 
     def setCacheDir(self, cachedir):
         """ Sets the internal cachedir value for the rpmdb, to be the
-            "installed" directory from this parent. """
+            "rpmdb-indexes" directory in the persisent yum storage. """
         if not os.path.normpath(cachedir).startswith(self.root):
-            self._cachedir = self.root + '/' + cachedir + "/installed/"
+            self._cachedir = self.root + '/' + cachedir
         else:
-            self._cachedir = '/' + cachedir + "/installed/"
+            self._cachedir = '/' + cachedir
 
     def readOnlyTS(self):
         if not self.ts:
commit 6526164c728cc28bd8d7b357768e0620dbc7a4fe
Author: James Antill <james at and.org>
Date:   Wed May 5 15:53:00 2010 -0400

    Fix deselections like '-*debuginfo' etc.

diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 69ff86d..d574b80 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -202,15 +202,16 @@ class TransactionData:
         txmbrs = self.matchNaevr(pattern)
         if not txmbrs:
             na = pattern.rsplit('.', 2)
-            txmbrs = self.matchNaevr(na[0], na[1])
+            if len(na) == 2:
+                txmbrs = self.matchNaevr(na[0], na[1])
 
         if not txmbrs:
-            if self.pkgSack is not None:
+            if self.pkgSack is None:
                 pkgs = []
             else:
-                pkgs = self.pkgSack.returnPackages(pattern)
+                pkgs = self.pkgSack.returnPackages(patterns=[pattern])
             if not pkgs:
-                pkgs = self.rpmdb.returnPackages(pattern)
+                pkgs = self.rpmdb.returnPackages(patterns=[pattern])
 
             for pkg in pkgs:
                 txmbrs.extend(self.getMembers(pkg.pkgtup))


More information about the Yum-commits mailing list