[yum-cvs] yum/yum depsolve.py,1.171,1.172

Seth Vidal skvidal at linux.duke.edu
Mon Jul 2 00:00:25 UTC 2007


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv21499

Modified Files:
	depsolve.py 
Log Message:

fix for rh bug 246078 - when multiple packages provide the dep, choose the
one with the closest arch to the requesting arch as possible. Helps ENDLESS
multilib situations.



Index: depsolve.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/depsolve.py,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -r1.171 -r1.172
--- depsolve.py	26 Jun 2007 16:01:01 -0000	1.171
+++ depsolve.py	2 Jul 2007 00:00:23 -0000	1.172
@@ -22,6 +22,7 @@
 import rpmUtils.transaction
 import rpmUtils.miscutils
 import rpmUtils.arch
+from rpmUtils.arch import archDifference
 from misc import unique, version_tuple_to_string
 import rpm
 
@@ -568,11 +569,27 @@
         
 
         # find the best one 
+        # first, find out which arch of the ones we can choose from is closest
+        # to the arch of the requesting pkg
+        reqpkg = self.tsInfo.matchNaevr(name=name, ver=version, rel=release)[0]
+        thisarch = reqpkg.arch
         newest = provSack.returnNewestByNameArch()
+                    
         if len(newest) > 1: # there's no way this can be zero
             best = newest[0]
             for po in newest[1:]:
-                if len(po.name) < len(best.name):
+                if thisarch != 'noarch':
+                    best_dist = archDifference(thisarch, best.arch)
+                    po_dist = archDifference(thisarch, po.arch)
+                    if po_dist > 0 and best_dist > po_dist:
+                        best = po
+                        continue
+                    if best_dist == po_dist:
+                        if len(po.name) < len(best.name):
+                            best=po
+                            continue
+                            
+                elif len(po.name) < len(best.name):
                     best = po
                 elif len(po.name) == len(best.name):
                     # compare arch




More information about the Yum-cvs-commits mailing list