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

James Antill james at linux.duke.edu
Tue Jun 24 21:24:04 UTC 2008


 yum/__init__.py    |   25 +++++++++++++++++++------
 yum/packageSack.py |   12 ++++++++----
 2 files changed, 27 insertions(+), 10 deletions(-)

New commits:
commit 14d1fa3db112f7f93ee9b41b74085110e10b9f73
Author: James Antill <james at and.org>
Date:   Tue Jun 24 17:23:54 2008 -0400

    Make sure we only consider the newest names, among all the arch varients

diff --git a/yum/__init__.py b/yum/__init__.py
index bbf3df8..bcdab95 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -53,7 +53,7 @@ from parser import ConfigPreProcessor
 import transactioninfo
 import urlgrabber
 from urlgrabber.grabber import URLGrabError
-from packageSack import packagesNewestByNameArch
+from packageSack import packagesNewestByNameArch, packagesNewestByName
 import depsolve
 import plugins
 import logginglevels
@@ -2034,11 +2034,24 @@ class YumBase(depsolve.Depsolve):
             
         if len(pkglist) == 1:
             return pkglist[0]
-        
-        bestlist = packagesNewestByNameArch(pkglist)
-        
-        best = bestlist[0]
-        for pkg in bestlist[1:]:
+
+        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
commit 40471d1d681f62415487def517ac90f253fafa9b
Author: James Antill <james at and.org>
Date:   Tue Jun 24 17:21:26 2008 -0400

     Fix packagesNewestByName() to use comparePoEVR as pkg.__cmp__ uses .arch info.
       thus we'd only get one pkg from the alph sorted arch.
       kind of a weird interface, not quite the "same" as packageNewestByNameArch()

diff --git a/yum/packageSack.py b/yum/packageSack.py
index 53cfced..8bc36f8 100644
--- a/yum/packageSack.py
+++ b/yum/packageSack.py
@@ -23,6 +23,7 @@ import warnings
 import re
 import fnmatch
 import misc
+import packages
 
 class PackageSackBase(object):
     """Base class that provides the interface for PackageSacks."""
@@ -838,11 +839,14 @@ def packagesNewestByName(pkgs):
     newest = {}
     for pkg in pkgs:
         key = pkg.name
-        if key not in newest or pkg > newest[key][0]:
+
+        # Can't use pkg.__cmp__ because it takes .arch into account
+        cval = 1
+        if key in newest:
+            cval = packages.comparePoEVR(pkg, newest[key][0])
+        if cval > 0:
             newest[key] = [pkg]
-        elif pkg < newest[key][0]:
-            continue
-        else:
+        elif cval == 0:
             newest[key].append(pkg)
     ret = []
     for vals in newest.itervalues():



More information about the Yum-cvs-commits mailing list