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

James Antill james at linux.duke.edu
Thu Sep 4 19:24:02 UTC 2008


 yum/__init__.py |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 8732871e2946b1cf5237cf1b2ed7517d4fa5261c
Author: James Antill <james at and.org>
Date:   Thu Sep 4 15:23:08 2008 -0400

    Only return a single package name on provide based installs, bug 460783

diff --git a/yum/__init__.py b/yum/__init__.py
index 6fdb59d..cd86054 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2141,7 +2141,7 @@ class YumBase(depsolve.Depsolve):
 
         return best
 
-    def bestPackagesFromList(self, pkglist, arch=None):
+    def bestPackagesFromList(self, pkglist, arch=None, single_name=False):
         """Takes a list of packages, returns the best packages.
            This function is multilib aware so that it will not compare
            multilib to singlelib packages""" 
@@ -2166,6 +2166,10 @@ class YumBase(depsolve.Depsolve):
         single = self._bestPackageFromList(singleLib)
         no = self._bestPackageFromList(noarch)
 
+        if single_name and multi and single and multi.name != single.name:
+            # Sinlge _must_ match multi, if we want a single package name
+            single = None
+
         # now, to figure out which arches we actually want
         # if there aren't noarch packages, it's easy. multi + single
         if no is None:
@@ -2291,9 +2295,11 @@ class YumBase(depsolve.Depsolve):
                         mypkgs = self.returnPackagesByDep(arg)
                     except yum.Errors.YumBaseError, e:
                         self.logger.critical(_('No Match for argument: %s') % arg)
-                    else:
-                        if mypkgs:
-                            pkgs.extend(self.bestPackagesFromList(mypkgs))
+                    elif mypkgs: #  Dep. installs don't do wildcards, so we
+                                 # just want a single named package.
+                        mypkgs = self.bestPackagesFromList(mypkgs,
+                                                           single_name=True)
+                        pkgs.extend(mypkgs)
                         
             else:
                 nevra_dict = self._nevra_kwarg_parse(kwargs)



More information about the Yum-cvs-commits mailing list