[yum-git] Branch 'yum-3_2_X' - yum/depsolve.py

James Antill james at linux.duke.edu
Sat Aug 9 19:11:23 UTC 2008


 yum/depsolve.py |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 65521318e01076b246b2fbdc4521fbd111a336f1
Author: James Antill <james at and.org>
Date:   Sat Aug 9 15:11:11 2008 -0400

    Sort the requires, so we handle things like BZ 443459 and test_multi_inst_dep*

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 6bb0ef6..ef84143 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -788,6 +788,17 @@ class Depsolve(object):
 
         return CheckDeps, CheckInstalls, CheckRemoves, any_missing
 
+    @staticmethod
+    def _sort_reqs(pkgtup1, pkgtup2):
+        """ Sort the requires for a package from most "narrow" to least,
+            this tries to ensure that if we have two reqs like
+            "libfoo = 1.2.3-4" and "foo-api" (which is also provided by
+            libxyz-foo) that we'll get just libfoo.
+            There are other similar cases this "handles"."""
+
+        mapper = {'EQ' : 1, 'LT' : 2, 'LE' : 3, 'GT' : 4, 'GE' : 5,
+                  None : 99}
+        return mapper.get(pkgtup1[1], 10) - mapper.get(pkgtup2[1], 10)
 
     def _checkInstall(self, txmbr):
         txmbr_reqs = txmbr.po.returnPrco('requires')
@@ -801,7 +812,7 @@ class Depsolve(object):
         oldreqs = set(oldreqs)
 
         ret = []
-        for req in txmbr_reqs:
+        for req in sorted(txmbr_reqs, cmp=self._sort_reqs):
             if req[0].startswith('rpmlib('):
                 continue
             if req in txmbr_provs:



More information about the Yum-cvs-commits mailing list