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

skvidal at osuosl.org skvidal at osuosl.org
Wed Jan 21 21:41:50 UTC 2009


 yum/__init__.py |   34 +++-------------------------------
 1 file changed, 3 insertions(+), 31 deletions(-)

New commits:
commit 989e4860c4a88180c3d9a6ab5f8ef53c9e9e58b8
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Wed Jan 21 16:40:42 2009 -0500

    apply patch from Ville Skyttä to use compare_providers for bestpackagefromlist, too
    closed rh bug: 460777

diff --git a/yum/__init__.py b/yum/__init__.py
index 6b2c701..06f0b19 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -54,7 +54,7 @@ import transactioninfo
 import urlgrabber
 from urlgrabber.grabber import URLGrabber, URLGrabError
 from urlgrabber.progress import format_number
-from packageSack import packagesNewestByNameArch, packagesNewestByName
+from packageSack import packagesNewestByNameArch
 import depsolve
 import plugins
 import logginglevels
@@ -2276,36 +2276,8 @@ class YumBase(depsolve.Depsolve):
         if len(pkglist) == 1:
             return pkglist[0]
 
-        bestlist  = packagesNewestByNameArch(pkglist)
-        #  Here we need the list of the latest version of each package
-        # the problem we are trying to fix is: ABC-1.2.i386 and ABC-1.3.noarch
-        # so in the above we need to "exclude" ABC < 1.3, which is done by
-        # making another list from newest by name and then make sure any pkg is
-        # in nbestlist.
-        nbestlist = packagesNewestByName(bestlist)
-
-        best = nbestlist[0]
-        nbestlist = set(nbestlist)
-        for pkg in bestlist:
-            if pkg == best:
-                continue
-            if pkg not in nbestlist:
-                continue
-
-            # This is basically _compare_providers() ... but without a reqpo
-            if len(pkg.name) < len(best.name): # shortest name silliness
-                best = pkg
-                continue
-            elif len(pkg.name) > len(best.name):
-                continue
-
-            # compare arch
-            arch = rpmUtils.arch.getBestArchFromList([pkg.arch, best.arch])
-            if arch == pkg.arch:
-                best = pkg
-                continue
-
-        return best
+        bestlist = self._compare_providers(pkglist, None)
+        return bestlist[0][0]
 
     def bestPackagesFromList(self, pkglist, arch=None, single_name=False):
         """Takes a list of packages, returns the best packages.


More information about the Yum-commits mailing list