[yum-commits] 2 commits - rpmUtils/arch.py

zpavlas at osuosl.org zpavlas at osuosl.org
Thu Mar 14 16:43:21 UTC 2013


 rpmUtils/arch.py |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 4868eef8149d130f6c0f22ac5c2f273e4e7386ee
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Wed Mar 13 12:24:58 2013 +0100

    call getCanonArch() only once

diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py
index 10b4331..57cbdfc 100644
--- a/rpmUtils/arch.py
+++ b/rpmUtils/arch.py
@@ -471,7 +471,7 @@ class ArchStorage(object):
         if arch:
             self.canonarch = arch
         else:
-            self.canonarch = getCanonArch()
+            self.canonarch = canonArch
         
         self.basearch = getBaseArch(myarch=self.canonarch)
         self.archlist = getArchList(thisarch=self.canonarch)
commit 51ca8f009ae1ec8fd2a6106a229d8e0c5aceabd4
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Thu Mar 14 12:18:04 2013 +0100

    speed up /proc/cpuinfo parsing on i585 and i686
    
    With 8 cores, /proc/cpuinfo is 240 lines,
    but we need just the first hit (cpu#0)

diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py
index d560be0..10b4331 100644
--- a/rpmUtils/arch.py
+++ b/rpmUtils/arch.py
@@ -227,8 +227,7 @@ def _try_read_cpuinfo():
     """ Try to read /proc/cpuinfo ... if we can't ignore errors (ie. proc not
         mounted). """
     try:
-        lines = open("/proc/cpuinfo", "r").readlines()
-        return lines
+        return open("/proc/cpuinfo", "r")
     except:
         return []
 
@@ -262,8 +261,10 @@ def getCanonX86Arch(arch):
     # 
     if arch == "i586":
         for line in _try_read_cpuinfo():
-            if line.startswith("model name") and line.find("Geode(TM)") != -1:
-                return "geode"
+            if line.startswith("model name"):
+                if line.find("Geode(TM)") != -1:
+                    return "geode"
+                break
         return arch
     # only athlon vs i686 isn't handled with uname currently
     if arch != "i686":
@@ -274,8 +275,10 @@ def getCanonX86Arch(arch):
         if line.startswith("vendor") and line.find("AuthenticAMD") != -1:
             return "athlon"
         # i686 doesn't guarantee cmov, but we depend on it
-        elif line.startswith("flags") and line.find("cmov") == -1:
-            return "i586"
+        elif line.startswith("flags"):
+            if line.find("cmov") == -1:
+                return "i586"
+            break
 
     return arch
 


More information about the Yum-commits mailing list