James Antill 5983bf4
commit 043e869b08126c1b24e392f809c9f6871344c60d
James Antill 5983bf4
Author: Seth Vidal <skvidal@fedoraproject.org>
James Antill 5983bf4
Date:   Wed May 4 09:43:52 2011 -0400
James Antill 5983bf4
James Antill 5983bf4
    make sure we use rpm ver cmp for the sort of the glibc requires
James Antill 5983bf4
    
James Antill 5983bf4
    when we're doing  collapse_libc_requires.
James Antill 5983bf4
    ultimately what's causing: https://bugzilla.redhat.com/show_bug.cgi?id=701744
James Antill 5983bf4
James Antill 5983bf4
diff --git a/rpmUtils/miscutils.py b/rpmUtils/miscutils.py
James Antill 5983bf4
index cdb1cb6..aea4550 100644
James Antill 5983bf4
--- a/rpmUtils/miscutils.py
James Antill 5983bf4
+++ b/rpmUtils/miscutils.py
James Antill 5983bf4
@@ -54,6 +54,10 @@ def compareEVR((e1, v1, r1), (e2, v2, r2)):
James Antill 5983bf4
     #print '%s, %s, %s vs %s, %s, %s = %s' % (e1, v1, r1, e2, v2, r2, rc)
James Antill 5983bf4
     return rc
James Antill 5983bf4
 
James Antill 5983bf4
+def compareVerOnly(v1, v2):
James Antill 5983bf4
+    """compare version strings only using rpm vercmp"""
James Antill 5983bf4
+    return compareEVR(('', v1, ''), ('', v2, ''))
James Antill 5983bf4
+    
James Antill 5983bf4
 def checkSig(ts, package):
James Antill 5983bf4
     """Takes a transaction set and a package, check it's sigs, 
James Antill 5983bf4
     return 0 if they are all fine
James Antill 5983bf4
diff --git a/yum/packages.py b/yum/packages.py
James Antill 5983bf4
index 264aa9a..e745a1a 100644
James Antill 5983bf4
--- a/yum/packages.py
James Antill 5983bf4
+++ b/yum/packages.py
James Antill 5983bf4
@@ -31,11 +31,12 @@ import warnings
James Antill 5983bf4
 from subprocess import Popen, PIPE
James Antill 5983bf4
 from rpmUtils import RpmUtilsError
James Antill 5983bf4
 import rpmUtils.miscutils
James Antill 5983bf4
-from rpmUtils.miscutils import flagToString, stringToVersion
James Antill 5983bf4
+from rpmUtils.miscutils import flagToString, stringToVersion, compareVerOnly
James Antill 5983bf4
 import Errors
James Antill 5983bf4
 import errno
James Antill 5983bf4
 import struct
James Antill 5983bf4
 from constants import *
James Antill 5983bf4
+from operator import itemgetter
James Antill 5983bf4
 
James Antill 5983bf4
 import urlparse
James Antill 5983bf4
 urlparse.uses_fragment.append("media")
James Antill 5983bf4
@@ -1139,7 +1140,11 @@ class YumAvailablePackage(PackageObject, RpmBase):
James Antill 5983bf4
         if hasattr(self, '_collapse_libc_requires') and self._collapse_libc_requires:
James Antill 5983bf4
             libc_requires = filter(lambda x: x[0].startswith('libc.so.6'), mylist)
James Antill 5983bf4
             if libc_requires:
James Antill 5983bf4
-                best = sorted(libc_requires)[-1]
James Antill 5983bf4
+                print libc_requires
James Antill 5983bf4
+                rest = sorted(libc_requires, cmp=compareVerOnly, key=itemgetter(0))
James Antill 5983bf4
+                best = rest.pop()
James Antill 5983bf4
+                if best[0].startswith('libc.so.6()'):
James Antill 5983bf4
+                    best = rest.pop()
James Antill 5983bf4
                 newlist = []
James Antill 5983bf4
                 for i in mylist:
James Antill 5983bf4
                     if i[0].startswith('libc.so.6') and i != best:
James Antill 5983bf4
commit 6bf7ca012bfb3d674df3f196f2f9e3eaabef0c91
James Antill 5983bf4
Author: Seth Vidal <skvidal@fedoraproject.org>
James Antill 5983bf4
Date:   Wed May 4 10:21:55 2011 -0400
James Antill 5983bf4
James Antill 5983bf4
    remove a debug print
James Antill 5983bf4
    add an explanation of why we skip libc.so.6()
James Antill 5983bf4
James Antill 5983bf4
diff --git a/yum/packages.py b/yum/packages.py
James Antill 5983bf4
index e745a1a..95c50a1 100644
James Antill 5983bf4
--- a/yum/packages.py
James Antill 5983bf4
+++ b/yum/packages.py
James Antill 5983bf4
@@ -1140,10 +1140,9 @@ class YumAvailablePackage(PackageObject, RpmBase):
James Antill 5983bf4
         if hasattr(self, '_collapse_libc_requires') and self._collapse_libc_requires:
James Antill 5983bf4
             libc_requires = filter(lambda x: x[0].startswith('libc.so.6'), mylist)
James Antill 5983bf4
             if libc_requires:
James Antill 5983bf4
-                print libc_requires
James Antill 5983bf4
                 rest = sorted(libc_requires, cmp=compareVerOnly, key=itemgetter(0))
James Antill 5983bf4
                 best = rest.pop()
James Antill 5983bf4
-                if best[0].startswith('libc.so.6()'):
James Antill 5983bf4
+                if best[0].startswith('libc.so.6()'): # rpmvercmp will sort this one as 'highest' so we need to remove it from the list
James Antill 5983bf4
                     best = rest.pop()
James Antill 5983bf4
                 newlist = []
James Antill 5983bf4
                 for i in mylist: