Hello,

The attached patch fixes an unbound local error and an attribute error in 
getCanonSPARCArch() when called on non-SPARC.  Maybe it should additionally 
have an early fail-fast test like other getCanon*Arch() have as their first 
thing, but I don't know what that test should be on SPARC.
From bac9df4a5fd6cfa7599f0c030d7c881c9c6bfde2 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ville=20Skytt=C3=A4?= <ville.sky...@iki.fi>
Date: Mon, 31 Aug 2009 21:53:08 +0300
Subject: [PATCH 4/4] Fix getCanonSPARCArch() "crash" when called on non-SPARC.

---
 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

_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to