Blob Blame History Raw
From 14d1fa3db112f7f93ee9b41b74085110e10b9f73 Mon Sep 17 00:00:00 2001
From: James Antill <james@and.org>
Date: Tue, 24 Jun 2008 17:23:54 -0400
Subject: [PATCH] Make sure we only consider the newest names, among all the arch varients

---
 yum/__init__.py |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

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
-- 
1.5.5.2