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

skvidal at osuosl.org skvidal at osuosl.org
Thu Dec 4 22:15:17 UTC 2008


 yum/__init__.py |   32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 4d28a994dddfcd80a23eb5d0b83ed989dcbc4de8
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Dec 4 17:13:35 2008 -0500

    - check if a requested install pkg is obsoleted before we check if it is already installed
    fixes rh bug #474514
    - allow provides-based updating just like remove and install have.

diff --git a/yum/__init__.py b/yum/__init__.py
index 1f03840..681ddc7 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2541,6 +2541,16 @@ class YumBase(depsolve.Depsolve):
                 tx_return.extend(txmbrs)
                 continue
             
+            #  Make sure we're not installing a package which is obsoleted by
+            # something else in the repo. Unless there is a obsoletion loop,
+            # at which point ignore everything.
+            obsoleting_pkg = self._test_loop(po, self._pkg2obspkg)
+            if obsoleting_pkg is not None:
+                self.verbose_logger.warning(_('Package %s is obsoleted by %s, trying to install %s instead'),
+                    po.name, obsoleting_pkg.name, obsoleting_pkg)               
+                self.install(po=obsoleting_pkg)
+                continue
+            
             # make sure it's not already installed
             if self.rpmdb.contains(po=po):
                 if not self.tsInfo.getMembersWithState(po.pkgtup, TS_REMOVE_STATES):
@@ -2556,15 +2566,6 @@ class YumBase(depsolve.Depsolve):
                     tx_return.extend(txmbrs)
                     continue
 
-            #  Make sure we're not installing a package which is obsoleted by
-            # something else in the repo. Unless there is a obsoletion loop,
-            # at which point ignore everything.
-            obsoleting_pkg = self._test_loop(po, self._pkg2obspkg)
-            if obsoleting_pkg is not None:
-                self.verbose_logger.warning(_('Package %s is obsoleted by %s, trying to install %s instead'),
-                    po.name, obsoleting_pkg.name, obsoleting_pkg)               
-                self.install(po=obsoleting_pkg)
-                continue
                 
             # at this point we are going to mark the pkg to be installed, make sure
             # it doesn't obsolete anything. If it does, mark that in the tsInfo, too
@@ -2685,6 +2686,19 @@ class YumBase(depsolve.Depsolve):
             instpkgs.extend(e)
             instpkgs.extend(m)
 
+            if u:
+                depmatches = []
+                arg = u[0]
+                try:
+                    depmatches = self.returnInstalledPackagesByDep(arg)
+                except yum.Errors.YumBaseError, e:
+                    self.logger.critical(_('%s') % e)
+                
+                if not depmatches:
+                    self.logger.critical(_('No Match for argument: %s') % arg)
+                else:
+                    instpkgs.extend(depmatches)
+
             # if we can't find an installed package then look at available pkgs
             if not instpkgs:
                 (e, m, u) = self.pkgSack.matchPackageNames([kwargs['pattern']])


More information about the Yum-commits mailing list