[Yum-devel] [PATCH] Fix getCanonSPARCArch() "crash" when called on non-SPARC.

Seth Vidal skvidal at fedoraproject.org
Tue Sep 15 21:01:41 UTC 2009


From: Ville Skyttä <ville.skytta at iki.fi>

---
 rpmUtils/arch.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py
index d22782b..edfc707 100644
--- a/rpmUtils/arch.py
+++ b/rpmUtils/arch.py
@@ -255,6 +255,7 @@ def getCanonPPCArch(arch):
 
 def getCanonSPARCArch(arch):
     # Deal with sun4v, sun4u, sun4m cases
+    SPARCtype = None
     f = open("/proc/cpuinfo", "r")
     lines = f.readlines()
     f.close()
@@ -262,6 +263,9 @@ def getCanonSPARCArch(arch):
         if line.startswith("type"):
             SPARCtype = line.split(':')[1]
             break
+    if SPARCtype is None:
+        return arch
+
     if SPARCtype.find("sun4v") != -1:
         if arch.startswith("sparc64"):
             return "sparc64v"
-- 
1.6.2.5



More information about the Yum-devel mailing list