Blob Blame History Raw
commit 043e869b08126c1b24e392f809c9f6871344c60d
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Wed May 4 09:43:52 2011 -0400

    make sure we use rpm ver cmp for the sort of the glibc requires
    
    when we're doing  collapse_libc_requires.
    ultimately what's causing: https://bugzilla.redhat.com/show_bug.cgi?id=701744

diff --git a/rpmUtils/miscutils.py b/rpmUtils/miscutils.py
index cdb1cb6..aea4550 100644
--- a/rpmUtils/miscutils.py
+++ b/rpmUtils/miscutils.py
@@ -54,6 +54,10 @@ def compareEVR((e1, v1, r1), (e2, v2, r2)):
     #print '%s, %s, %s vs %s, %s, %s = %s' % (e1, v1, r1, e2, v2, r2, rc)
     return rc
 
+def compareVerOnly(v1, v2):
+    """compare version strings only using rpm vercmp"""
+    return compareEVR(('', v1, ''), ('', v2, ''))
+    
 def checkSig(ts, package):
     """Takes a transaction set and a package, check it's sigs, 
     return 0 if they are all fine
diff --git a/yum/packages.py b/yum/packages.py
index 264aa9a..e745a1a 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -31,11 +31,12 @@ import warnings
 from subprocess import Popen, PIPE
 from rpmUtils import RpmUtilsError
 import rpmUtils.miscutils
-from rpmUtils.miscutils import flagToString, stringToVersion
+from rpmUtils.miscutils import flagToString, stringToVersion, compareVerOnly
 import Errors
 import errno
 import struct
 from constants import *
+from operator import itemgetter
 
 import urlparse
 urlparse.uses_fragment.append("media")
@@ -1139,7 +1140,11 @@ class YumAvailablePackage(PackageObject, RpmBase):
         if hasattr(self, '_collapse_libc_requires') and self._collapse_libc_requires:
             libc_requires = filter(lambda x: x[0].startswith('libc.so.6'), mylist)
             if libc_requires:
-                best = sorted(libc_requires)[-1]
+                print libc_requires
+                rest = sorted(libc_requires, cmp=compareVerOnly, key=itemgetter(0))
+                best = rest.pop()
+                if best[0].startswith('libc.so.6()'):
+                    best = rest.pop()
                 newlist = []
                 for i in mylist:
                     if i[0].startswith('libc.so.6') and i != best:
commit 6bf7ca012bfb3d674df3f196f2f9e3eaabef0c91
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Wed May 4 10:21:55 2011 -0400

    remove a debug print
    add an explanation of why we skip libc.so.6()

diff --git a/yum/packages.py b/yum/packages.py
index e745a1a..95c50a1 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1140,10 +1140,9 @@ class YumAvailablePackage(PackageObject, RpmBase):
         if hasattr(self, '_collapse_libc_requires') and self._collapse_libc_requires:
             libc_requires = filter(lambda x: x[0].startswith('libc.so.6'), mylist)
             if libc_requires:
-                print libc_requires
                 rest = sorted(libc_requires, cmp=compareVerOnly, key=itemgetter(0))
                 best = rest.pop()
-                if best[0].startswith('libc.so.6()'):
+                if best[0].startswith('libc.so.6()'): # rpmvercmp will sort this one as 'highest' so we need to remove it from the list
                     best = rest.pop()
                 newlist = []
                 for i in mylist: