[yum-commits] Branch 'yum-3_2_X' - 12 commits - cli.py docs/yum.8 rpmUtils/oldUtils.py yum/Errors.py yum/__init__.py yum/packages.py yum/rpmsack.py yum/yumRepo.py yumcommands.py

James Antill james at osuosl.org
Wed Mar 25 20:57:10 UTC 2009


 cli.py               |   53 ++++++++++++++--
 docs/yum.8           |   14 +++-
 rpmUtils/oldUtils.py |    7 ++
 yum/Errors.py        |    3 
 yum/__init__.py      |  160 +++++++++++++++++++++++++++++++++++++++++++++++----
 yum/packages.py      |   16 +++++
 yum/rpmsack.py       |    6 +
 yum/yumRepo.py       |    4 +
 yumcommands.py       |   28 ++++++++
 9 files changed, 266 insertions(+), 25 deletions(-)

New commits:
commit 54b4ecd0a75f83a8896f3407760a0c73cda37246
Author: James Antill <james at and.org>
Date:   Wed Mar 25 12:07:28 2009 -0400

    Allow old installonly pkgs. from local files

diff --git a/yum/__init__.py b/yum/__init__.py
index 1694201..de1b3c5 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3024,6 +3024,8 @@ class YumBase(depsolve.Depsolve):
                     installpkgs.append(po)
                 else:
                     donothingpkgs.append(po)
+            elif self.allowedMultipleInstalls(po):
+                installpkgs.append(po)
             else:
                 donothingpkgs.append(po)
 
commit b7dd069a8bb055dfd3319477022a5ad5b3c66f09
Author: James Antill <james at and.org>
Date:   Wed Mar 25 11:02:33 2009 -0400

    Cache verifyLocalPkg() successes

diff --git a/yum/packages.py b/yum/packages.py
index 319b87a..bb43b6c 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -671,6 +671,20 @@ class YumAvailablePackage(PackageObject, RpmBase):
         """check the package checksum vs the localPkg
            return True if pkg is good, False if not"""
 
+        #  This is called a few times now, so we want some way to not have to
+        # read+checksum "large" datasets multiple times per. transaction.
+        try:
+            nst = os.stat(self.localPkg())
+        except OSError, e:
+            return False
+        if hasattr(self, "_verify_local_pkg_cache"):
+            ost = self._verify_local_pkg_cache
+            if (ost.st_ino   == nst.st_ino   and
+                ost.st_dev   == nst.st_dev   and
+                ost.st_mtime == nst.st_mtime and
+                ost.st_size  == nst.st_size):
+                return True
+
         (csum_type, csum) = self.returnIdSum()
         
         try:
@@ -681,6 +695,8 @@ class YumAvailablePackage(PackageObject, RpmBase):
         if filesum != csum:
             return False
         
+        self._verify_local_pkg_cache = nst
+
         return True
         
     def prcoPrintable(self, prcoTuple):
commit 1107cb575401eb04e3a57647734e7c03ab5ca020
Author: James Antill <james at and.org>
Date:   Wed Mar 25 09:20:10 2009 -0400

    Fix rpmUtils.oldUtils, which noone should be using

diff --git a/rpmUtils/oldUtils.py b/rpmUtils/oldUtils.py
index 1216ce4..5011e8f 100644
--- a/rpmUtils/oldUtils.py
+++ b/rpmUtils/oldUtils.py
@@ -6,7 +6,12 @@ import os
 import gzip
 import sys
 from gzip import write32u, FNAME
+from urlgrabber.grabber import URLGrabError
+from zlib import error as zlibError
 
+def log(num, msg):
+    print >>sys.stderr, msg
+errorlog = log
 
 def _(msg):
     return msg
@@ -168,6 +173,8 @@ def _gzipOpen(filename, mode="rb", compresslevel=9):
     return GzipFile(filename, mode, compresslevel)
 
 class RPM_Base_Work:
+    def __init__(self):
+        self.hdr = None
 
     def _getTag(self, tag):
         if self.hdr is None:
commit 61afcf7858cb8c3b1c88ebe47bdbe4d6e41241e7
Author: James Antill <james at and.org>
Date:   Wed Mar 25 02:06:16 2009 -0400

    Work around rpmdb changing underneath us, BZ 476195

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 30594cf..1d0945b 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -54,8 +54,10 @@ class RPMInstalledPackage(YumInstalledPackage):
 
         ts = self.rpmdb.readOnlyTS()
         mi = ts.dbMatch(0, self.idx)
-        return mi.next()
-        return self.hdr
+        try:
+            return mi.next()
+        except StopIteration:
+            raise Errors.PackageSackError, 'Rpmdb changed underneath us'
 
     def __getattr__(self, varname):
         self.hdr = val = self._get_hdr()
commit 7c18574e1c36a0c8b414e4e8f6706732e0ec0213
Author: James Antill <james at and.org>
Date:   Wed Mar 25 01:23:58 2009 -0400

    Let reinstall work via. shell remove+install, cleanup probFilterFlags

diff --git a/yum/__init__.py b/yum/__init__.py
index 0efc056..1694201 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2454,6 +2454,11 @@ class YumBase(depsolve.Depsolve):
                 installed_pkg =  self.rpmdb.searchPkgTuple(inst_tup)[0]
                 yield installed_pkg
 
+    def _add_prob_flags(self, *flags):
+        """ Add all of the passed flags to the tsInfo.probFilterFlags array. """
+        for flag in flags:
+            if flag not in self.tsInfo.probFilterFlags:
+                self.tsInfo.probFilterFlags.append(flag)
 
     def install(self, po=None, **kwargs):
         """try to mark for install the item specified. Uses provided package 
@@ -2632,8 +2637,13 @@ class YumBase(depsolve.Depsolve):
             # or some other oddity. If it is - then modify the problem filter to cope
             
             for ipkg in self.rpmdb.searchNevra(name=po.name, arch=po.arch):
-                if ipkg.EVR > po.EVR:
-                    self.tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_OLDPACKAGE)
+                if ipkg.verEQ(po):
+                    self._add_prob_flags(rpm.RPMPROB_FILTER_REPLACEPKG,
+                                         rpm.RPMPROB_FILTER_REPLACENEWFILES,
+                                         rpm.RPMPROB_FILTER_REPLACEOLDFILES)
+                    break
+                if ipkg.verGT(po):
+                    self._add_prob_flags(rpm.RPMPROB_FILTER_OLDPACKAGE)
                     break
             
             # it doesn't obsolete anything. If it does, mark that in the tsInfo, too
@@ -3052,12 +3062,9 @@ class YumBase(depsolve.Depsolve):
         """Setup the problem filters to allow a reinstall to work, then
            pass everything off to install"""
            
-        if rpm.RPMPROB_FILTER_REPLACEPKG not in self.tsInfo.probFilterFlags:
-            self.tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_REPLACEPKG)
-        if rpm.RPMPROB_FILTER_REPLACENEWFILES not in self.tsInfo.probFilterFlags:
-            self.tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_REPLACENEWFILES)
-        if rpm.RPMPROB_FILTER_REPLACEOLDFILES not in self.tsInfo.probFilterFlags:
-            self.tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_REPLACEOLDFILES)
+        self._add_prob_flags(rpm.RPMPROB_FILTER_REPLACEPKG,
+                             rpm.RPMPROB_FILTER_REPLACENEWFILES,
+                             rpm.RPMPROB_FILTER_REPLACEOLDFILES)
 
         tx_mbrs = []
         tx_mbrs.extend(self.remove(po, **kwargs))
@@ -3193,7 +3200,7 @@ class YumBase(depsolve.Depsolve):
             if not atxmbr: # Fail?
                 self.tsInfo.remove(itxmbr.pkgtup)
                 continue
-            self.tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_OLDPACKAGE)
+            self._add_prob_flags(rpm.RPMPROB_FILTER_OLDPACKAGE)
             tx_return.append(itxmbr)
             tx_return.append(atxmbr)
 
commit 500414cd3438467b2aa249888f59c269059a4313
Author: James Antill <james at and.org>
Date:   Tue Mar 24 18:08:54 2009 -0400

    Add documentation for downgrade command

diff --git a/docs/yum.8 b/docs/yum.8
index 3818902..0e65dcb 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -59,7 +59,9 @@ gnome\-packagekit application\&.
 .br
 .I \fR * localupdate rpmfile1 [rpmfile2] [\&.\&.\&.] 
 .br
-.I \fR * reinstall package1
+.I \fR * reinstall package1 [package2] [\&.\&.\&.] 
+.br
+.I \fR * downgrade package1 [package2] [\&.\&.\&.] 
 .br
 .I \fR * deplist package1 [package2] [\&.\&.\&.] 
 .br
@@ -191,8 +193,14 @@ If required the enabled repositories will be used to resolve dependencies.
 .IP
 .IP "\fBreinstall\fP"
 Will reinstall the identically versioned package as is currently installed. 
-It will not necessarily work for all pkgs. Kernels, in particular are not
-going to play nicely with this.
+This does not work for "installonly" packages, like Kernels.
+.IP
+.IP "\fBdowngrade\fP"
+Will try and downgrade a package from the version currently installed to the
+previously highest version (or the specified version).
+The depsolver will not necessarily work, but if you specify all the packages it
+should work (and thus. all the simple cases will work). Also this does not
+work for "installonly" packages, like Kernels.
 .IP
 .IP "\fBdeplist\fP"
 Produces a list of all dependencies and what packages provide those
commit 685a67d4c27389bb70034ee205470d5f6ee5b562
Author: James Antill <james at and.org>
Date:   Tue Mar 24 10:37:15 2009 -0400

    Add extra UI corner cases, only local downgrade missing now (I think).

diff --git a/cli.py b/cli.py
index acca487..3cfb402 100644
--- a/cli.py
+++ b/cli.py
@@ -565,7 +565,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         """Attempts to take the user specified list of packages/wildcards
            and install them, or if they are installed, update them to a newer
            version. If a complete version number if specified, attempt to 
-           downgrade them to the specified version"""
+           upgrade (or downgrade if they have been removed) them to the
+           specified version"""
         # get the list of available packages
         # iterate over the user's list
         # add packages to Transaction holding class if they match.
@@ -575,9 +576,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         
         oldcount = len(self.tsInfo)
         
-        toBeInstalled = {} # keyed on name
-        passToUpdate = [] # list of pkgtups to pass along to updatecheck
-
         for arg in userlist:
             if os.path.exists(arg) and arg.endswith('.rpm'): # this is hurky, deal w/it
                 val, msglist = self.localInstall(filelist=[arg])
@@ -648,6 +646,33 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         else:
             return 0, [_('No Packages marked for removal')]
     
+    def downgradePkgs(self, userlist):
+        """Attempts to take the user specified list of packages/wildcards
+           and downgrade them. If a complete version number if specified,
+           attempt to downgrade them to the specified version"""
+
+        oldcount = len(self.tsInfo)
+        
+        for arg in userlist:
+            # FIXME: We should allow local file downgrades too
+            #        even more important for Fedora.
+            if False and os.path.exists(arg) and arg.endswith('.rpm'):
+                val, msglist = self.localDowngrade(filelist=[arg])
+                continue # it was something on disk and it ended in rpm 
+                         # no matter what we don't go looking at repos
+
+            try:
+                self.downgrade(pattern=arg)
+            except yum.Errors.DowngradeError:
+                self.verbose_logger.log(yum.logginglevels.INFO_2,
+                                        _('No package %s%s%s available.'),
+                                        self.term.MODE['bold'], arg,
+                                        self.term.MODE['normal'])
+                self._maybeYouMeant(arg)
+        if len(self.tsInfo) > oldcount:
+            return 2, [_('Package(s) to downgrade')]
+        return 0, [_('Nothing to do')]
+        
     def localInstall(self, filelist, updateonly=0):
         """handles installs/updates of rpms provided on the filesystem in a 
            local dir (ie: not from a repo)"""
diff --git a/yum/Errors.py b/yum/Errors.py
index de777a6..322765e 100644
--- a/yum/Errors.py
+++ b/yum/Errors.py
@@ -86,6 +86,9 @@ class RemoveError(YumBaseError):
 class ReinstallError(YumBaseError):
     pass
 
+class DowngradeError(YumBaseError):
+    pass
+
 class RepoMDError(YumBaseError):
     pass
 
diff --git a/yum/__init__.py b/yum/__init__.py
index f166295..0efc056 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2432,6 +2432,21 @@ class YumBase(depsolve.Depsolve):
             tx_return.extend(txmbrs)
         return tx_return
 
+    #  Note that this returns available pkgs, and not txmbrs like the other
+    # _at_group* functions.
+    def _at_groupdowngrade(self, pattern):
+        " Do downgrade of a group via. leading @ on the cmd line."
+        assert pattern[0] == '@'
+        grpid = pattern[1:]
+
+        thesegroups = self.comps.return_groups(grpid)
+        if not thesegroups:
+            raise Errors.GroupsError, _("No Group named %s exists") % grpid
+        pkgnames = set()
+        for thisgroup in thesegroups:
+            pkgnames.update(thisgroup.packages)
+        return self.pkgSack.searchNames(pkgnames)
+
     def _find_obsoletees(self, po):
         """ Return the pkgs. that are obsoleted by the po we pass in. """
         for (obstup, inst_tup) in self.up.getObsoletersTuples(name=po.name):
@@ -2540,6 +2555,7 @@ class YumBase(depsolve.Depsolve):
                     lst.extend(self.bestPackagesFromList(pkgs))
                 pkgs = lst
 
+
         if not pkgs:
             # Do we still want to return errors here?
             # We don't in the cases below, so I didn't here...
@@ -3073,7 +3089,7 @@ class YumBase(depsolve.Depsolve):
         tx_mbrs.extend(new_members)
         return tx_mbrs
         
-    def downgrade(self, **kwargs):
+    def downgrade(self, po=None, **kwargs):
         """ Try to downgrade a package. Works like:
             % yum shell <<EOL
             remove  abcd
@@ -3081,13 +3097,29 @@ class YumBase(depsolve.Depsolve):
             run
             EOL """
 
-        # FIXME: Add @group?
-        if 'pattern' in kwargs:
-            if False and kwargs['pattern'][0] == '@':
-                return [] # We _could_ do this, I guess.
+        if not po and not kwargs:
+            raise Errors.DowngradeError, 'Nothing specified to remove'
+
+        doing_group_pkgs = False
+        if po:
+            apkgs = [po]
+        elif 'pattern' in kwargs:
+            if kwargs['pattern'][0] == '@':
+               apkgs = self._at_groupdowngrade(kwargs['pattern'])
+               doing_group_pkgs = True # Don't warn. about some things
+            else:
+               apkgs = self.pkgSack.returnPackages(patterns=[kwargs['pattern']],
+                                                   ignore_case=False)
+               if not apkgs:
+                    arg = kwargs['pattern']
+                    self.verbose_logger.debug(_('Checking for virtual provide or file-provide for %s'), 
+                        arg)
+
+                    try:
+                        apkgs = self.returnPackagesByDep(arg)
+                    except yum.Errors.YumBaseError, e:
+                        self.logger.critical(_('No Match for argument: %s') % arg)
 
-            apkgs = self.pkgSack.returnPackages(patterns=[kwargs['pattern']])
-            # FIXME: Add umatched and/or deps.
         else:
             nevra_dict = self._nevra_kwarg_parse(kwargs)
             apkgs = self.pkgSack.searchNevra(name=nevra_dict['name'], 
@@ -3095,6 +3127,18 @@ class YumBase(depsolve.Depsolve):
                                              arch=nevra_dict['arch'], 
                                              ver=nevra_dict['version'],
                                              rel=nevra_dict['release'])
+        if not apkgs:
+            # Do we still want to return errors here?
+            # We don't in the cases below, so I didn't here...
+            if 'pattern' in kwargs:
+                pkgs = self.rpmdb.returnPackages(patterns=[kwargs['pattern']],
+                                                 ignore_case=False)
+            if 'name' in kwargs:
+                pkgs = self.rpmdb.searchNevra(name=kwargs['name'])
+            if pkgs:
+                return []
+            raise Errors.DowngradeError, _('No package(s) available to downgrade')
+
         warned_names = set()
         # Skip kernel etc.
         tapkgs = []
@@ -3123,14 +3167,18 @@ class YumBase(depsolve.Depsolve):
         downgrade_apkgs = {}
         for pkg in sorted(apkgs):
             if pkg.name not in latest_installed:
-                if pkg.name not in warned_names:
+                if pkg.name not in warned_names and not doing_group_pkgs:
                     msg = _('No Match for available package: %s') % pkg
                     self.logger.critical(msg)
                 warned_names.add(pkg.name)
                 continue
             if pkg.verGE(latest_installed[pkg.name]):
-                # FIXME: Add error stuff if we only have later than installed
+                if pkg.name not in warned_names:
+                    msg = _('Only Upgrade available on package: %s') % pkg
+                    self.logger.critical(msg)
+                warned_names.add(pkg.name)
                 continue
+            warned_names.add(pkg.name)
             if (pkg.name in downgrade_apkgs and
                 pkg.verLE(downgrade_apkgs[pkg.name])):
                 continue # Skip older than "latest downgrade"
diff --git a/yumcommands.py b/yumcommands.py
index c2f9497..c387e4f 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1003,6 +1003,8 @@ class ReInstallCommand(YumCommand):
         self.doneCommand(base, _("Setting up Reinstall Process"))
         oldcount = len(base.tsInfo)
         try:
+            # FIXME: Due to not having reinstallPkgs() we don't get
+            #        localreinstall and maybe_you_meant features.
             for item in extcmds:
                 base.reinstall(pattern=item)
 
@@ -1033,17 +1035,10 @@ class DowngradeCommand(YumCommand):
 
     def doCommand(self, base, basecmd, extcmds):
         self.doneCommand(base, _("Setting up Downgrade Process"))
-        oldcount = len(base.tsInfo)
         try:
-            for item in extcmds:
-                base.downgrade(pattern=item)
-
-            if len(base.tsInfo) > oldcount:
-                return 2, [_('Package(s) to downgrade')]
-            return 0, [_('Nothing to do')]            
-            
+            return base.downgradePkgs(extcmds)
         except yum.Errors.YumBaseError, e:
-            return 1, [to_unicode(e)]
+            return 1, [str(e)]
 
     def getSummary(self):
         return _("downgrade a package")
commit 8cf1dd38203b6a6a037a6a454270373eb73d51b7
Author: James Antill <james at and.org>
Date:   Tue Mar 24 10:19:59 2009 -0400

    Add downgrade UI command

diff --git a/cli.py b/cli.py
index fbc6f79..acca487 100644
--- a/cli.py
+++ b/cli.py
@@ -98,6 +98,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         self.registerCommand(yumcommands.RepoListCommand())
         self.registerCommand(yumcommands.HelpCommand())
         self.registerCommand(yumcommands.ReInstallCommand())        
+        self.registerCommand(yumcommands.DowngradeCommand())        
 
     def registerCommand(self, command):
         for name in command.getNames():
diff --git a/yumcommands.py b/yumcommands.py
index fee8060..c2f9497 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1007,7 +1007,7 @@ class ReInstallCommand(YumCommand):
                 base.reinstall(pattern=item)
 
             if len(base.tsInfo) > oldcount:
-                return 2, [_('Package(s) to install')]
+                return 2, [_('Package(s) to reinstall')]
             return 0, [_('Nothing to do')]            
             
         except yum.Errors.YumBaseError, e:
@@ -1016,6 +1016,37 @@ class ReInstallCommand(YumCommand):
     def getSummary(self):
         return _("reinstall a package")
 
+    def needTs(self, base, basecmd, extcmds):
+        return False
+        
+class DowngradeCommand(YumCommand):
+    def getNames(self):
+        return ['downgrade']
+
+    def getUsage(self):
+        return "PACKAGE..."
+
+    def doCheck(self, base, basecmd, extcmds):
+        checkRootUID(base)
+        checkGPGKey(base)
+        checkPackageArg(base, basecmd, extcmds)
+
+    def doCommand(self, base, basecmd, extcmds):
+        self.doneCommand(base, _("Setting up Downgrade Process"))
+        oldcount = len(base.tsInfo)
+        try:
+            for item in extcmds:
+                base.downgrade(pattern=item)
+
+            if len(base.tsInfo) > oldcount:
+                return 2, [_('Package(s) to downgrade')]
+            return 0, [_('Nothing to do')]            
+            
+        except yum.Errors.YumBaseError, e:
+            return 1, [to_unicode(e)]
+
+    def getSummary(self):
+        return _("downgrade a package")
 
     def needTs(self, base, basecmd, extcmds):
         return False
commit 29fbc5d5683d172234b18e357e9e6f52c975300f
Author: James Antill <james at and.org>
Date:   Tue Mar 24 01:07:11 2009 -0400

    Add downgrade() function, couple of FIXME's still there for corner case UI.

diff --git a/yum/__init__.py b/yum/__init__.py
index 6364bf5..f166295 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3073,7 +3073,83 @@ class YumBase(depsolve.Depsolve):
         tx_mbrs.extend(new_members)
         return tx_mbrs
         
+    def downgrade(self, **kwargs):
+        """ Try to downgrade a package. Works like:
+            % yum shell <<EOL
+            remove  abcd
+            install abcd-<old-version>
+            run
+            EOL """
+
+        # FIXME: Add @group?
+        if 'pattern' in kwargs:
+            if False and kwargs['pattern'][0] == '@':
+                return [] # We _could_ do this, I guess.
+
+            apkgs = self.pkgSack.returnPackages(patterns=[kwargs['pattern']])
+            # FIXME: Add umatched and/or deps.
+        else:
+            nevra_dict = self._nevra_kwarg_parse(kwargs)
+            apkgs = self.pkgSack.searchNevra(name=nevra_dict['name'], 
+                                             epoch=nevra_dict['epoch'],
+                                             arch=nevra_dict['arch'], 
+                                             ver=nevra_dict['version'],
+                                             rel=nevra_dict['release'])
+        warned_names = set()
+        # Skip kernel etc.
+        tapkgs = []
+        for pkg in apkgs:
+            if self.allowedMultipleInstalls(pkg):
+                if pkg.name not in warned_names:
+                    msg = _("Package %s is allowed multiple installs, skipping") % pkg
+                    self.verbose_logger.log(logginglevels.INFO_2, msg)
+                warned_names.add(pkg.name)
+                continue
+            tapkgs.append(pkg)
+        apkgs = tapkgs
+
+        # Find installed versions of "to downgrade pkgs"
+        apkg_names = set()
+        for pkg in apkgs:
+            apkg_names.add(pkg.name)
+        ipkgs = self.rpmdb.searchNames(list(apkg_names))
+
+        latest_installed = {}
+        for pkg in ipkgs:
+            latest_installed[pkg.name] = pkg
+
+        #  Find "latest downgrade", ie. latest available pkg before
+        # installed version.
+        downgrade_apkgs = {}
+        for pkg in sorted(apkgs):
+            if pkg.name not in latest_installed:
+                if pkg.name not in warned_names:
+                    msg = _('No Match for available package: %s') % pkg
+                    self.logger.critical(msg)
+                warned_names.add(pkg.name)
+                continue
+            if pkg.verGE(latest_installed[pkg.name]):
+                # FIXME: Add error stuff if we only have later than installed
+                continue
+            if (pkg.name in downgrade_apkgs and
+                pkg.verLE(downgrade_apkgs[pkg.name])):
+                continue # Skip older than "latest downgrade"
+            downgrade_apkgs[pkg.name] = pkg
 
+        tx_return = []
+        for po in ipkgs:
+            if po.name not in downgrade_apkgs:
+                continue
+            itxmbr = self.tsInfo.addErase(po)
+            atxmbr = self.tsInfo.addInstall(downgrade_apkgs[po.name])
+            if not atxmbr: # Fail?
+                self.tsInfo.remove(itxmbr.pkgtup)
+                continue
+            self.tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_OLDPACKAGE)
+            tx_return.append(itxmbr)
+            tx_return.append(atxmbr)
+
+        return tx_return
         
     def _nevra_kwarg_parse(self, kwargs):
             
commit 8916a42b4b48c51ddd9872dfb496ddba3e314f25
Author: James Antill <james at and.org>
Date:   Mon Mar 23 09:43:28 2009 -0400

    Output group id in verbose mode of grouplist

diff --git a/cli.py b/cli.py
index 0374667..fbc6f79 100644
--- a/cli.py
+++ b/cli.py
@@ -887,17 +887,26 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             self.verbose_logger.log(yum.logginglevels.INFO_2,
                 _('Installed Groups:'))
             for group in installed:
-                self.verbose_logger.log(yum.logginglevels.INFO_2, '   %s',
-                    group.ui_name)
+                if self.verbose_logger.isEnabledFor(yum.logginglevels.DEBUG_3):
+                    self.verbose_logger.log(yum.logginglevels.INFO_2,
+                                            '   %s (%s)', group.ui_name,
+                                            group.groupid)
+                else:
+                    self.verbose_logger.log(yum.logginglevels.INFO_2,
+                                            '   %s', group.ui_name)
         
         if len(available) > 0:
             self.verbose_logger.log(yum.logginglevels.INFO_2,
                 _('Available Groups:'))
             for group in available:
-                self.verbose_logger.log(yum.logginglevels.INFO_2, '   %s',
-                    group.ui_name)
+                if self.verbose_logger.isEnabledFor(yum.logginglevels.DEBUG_3):
+                    self.verbose_logger.log(yum.logginglevels.INFO_2,
+                                            '   %s (%s)', group.ui_name,
+                                            group.groupid)
+                else:
+                    self.verbose_logger.log(yum.logginglevels.INFO_2,
+                                            '   %s', group.ui_name)
 
-            
         return 0, [_('Done')]
     
     def returnGroupInfo(self, userlist):
commit 430668e360a6a8cdcca0ee8652b8d4ba1fb04728
Author: James Antill <james at and.org>
Date:   Thu Mar 19 16:10:09 2009 -0400

    Let "remove blah-2; install blah-1" work again

diff --git a/yum/__init__.py b/yum/__init__.py
index d526d8d..6364bf5 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2596,8 +2596,15 @@ class YumBase(depsolve.Depsolve):
 
             # make sure we don't have a name.arch of this already installed
             # if so pass it to update b/c it should be able to figure it out
-            if self.rpmdb.contains(name=po.name, arch=po.arch) and not self.allowedMultipleInstalls(po):
-                if not self.tsInfo.getMembersWithState(po.pkgtup, TS_REMOVE_STATES):
+            # if self.rpmdb.contains(name=po.name, arch=po.arch) and not self.allowedMultipleInstalls(po):
+            if not self.allowedMultipleInstalls(po):
+                found = True
+                for ipkg in self.rpmdb.searchNevra(name=po.name, arch=po.arch):
+                    found = False
+                    if self.tsInfo.getMembersWithState(ipkg.pkgtup, TS_REMOVE_STATES):
+                        found = True
+                        break
+                if not found:
                     self.verbose_logger.warning(_('Package matching %s already installed. Checking for update.'), po)            
                     txmbrs = self.update(po=po)
                     tx_return.extend(txmbrs)
commit 36e031100c16adf82ea68a3e59a7e7088a0fee9f
Author: James Antill <james at and.org>
Date:   Thu Mar 19 12:20:41 2009 -0400

    If the repomd.xml file doesn't exist, the cache isn't current

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index e5774bb..1ed5542 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -830,6 +830,10 @@ class YumRepository(Repository, config.RepoConf):
             if self.metalink and not os.path.exists(mlfn):
                 self._metadataCurrent = False
         if self._metadataCurrent is None:
+            repomdfn = self.cachedir + '/' + 'repomd.xml'
+            if not os.path.exists(repomdfn):
+                self._metadataCurrent = False
+        if self._metadataCurrent is None:
             self._metadataCurrent = self.withinCacheAge(self.metadata_cookie,
                                                         self.metadata_expire)
         return self._metadataCurrent


More information about the Yum-commits mailing list