[Yum-devel] [PATCH] rpmUtils.arch - fix arch overriding

Bill Nottingham notting at redhat.com
Fri Mar 16 00:52:43 UTC 2007


rpmUtils.arch has, at the bottom:

canonArch = getCanonArch()

This is presumably a) to optimize it so it's not done so often
b) to allow someone to override it after initialization if they
really want to.

However, it's not used everywhere it should. Hence, the attached.
It should have identical behavior in any case where someone's not
overriding it.

Bill
-------------- next part --------------
--- rpmUtils/arch.py	2007-01-21 14:52:00.000000000 -0500
+++ rpmUtils/arch.py	2007-03-15 20:47:59.000000000 -0400
@@ -71,7 +71,7 @@
 def isMultiLibArch(arch=None):
     """returns true if arch is a multilib arch, false if not"""
     if arch is None:
-        arch = getCanonArch()
+        arch = canonArch
 
     if not arches.has_key(arch): # or we could check if it is noarch
         return 0
@@ -91,7 +91,7 @@
     """
     
     if myarch is None:
-        myarch = getCanonArch()
+        myarch = canonArch
 
     if len(archlist) == 0:
         return None
@@ -123,7 +123,7 @@
 def getArchList(thisarch=None):
     # this returns a list of archs that are compatible with arch given
     if not thisarch:
-        thisarch = getCanonArch()
+        thisarch = canonArch
     
     archlist = [thisarch]
     while arches.has_key(thisarch):
@@ -248,8 +248,10 @@
 
     return arch
 
+canonArch = getCanonArch()
+
 # this gets you the "compat" arch of a biarch pair
-def getMultiArchInfo(arch = getCanonArch()):
+def getMultiArchInfo(arch = canonArch):
     if multilibArches.has_key(arch):
         return multilibArches[arch]
     if arches.has_key(arch) and arches[arch] != "noarch":
@@ -276,7 +278,7 @@
        a key in the multilibArches."""
 
     if not myarch:
-        myarch = getCanonArch()
+        myarch = canonArch
 
     if not arches.has_key(myarch): # this is dumb, but <shrug>
         return myarch
@@ -301,4 +303,3 @@
     
         return basearch
         
-canonArch = getCanonArch()


More information about the Yum-devel mailing list