]> git.ipfire.org Git - pakfire.git/commitdiff
Make a better selection of architectures.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jan 2012 11:36:30 +0000 (12:36 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jan 2012 11:36:30 +0000 (12:36 +0100)
If a system does not support one architecture natively,
we are going to select the best available architecture.

python/pakfire/cli.py
python/pakfire/distro.py
python/pakfire/system.py

index bdb564a816a55d1f4b6f41184ad01dd887cd1650..6d19e97fcbbcf4f1f431baaf744d26b3e27fd47e 100644 (file)
@@ -862,7 +862,9 @@ class CliClient(Cli):
                ret.append("      %-16s: %s" % (_("CPU model"), system.cpu_model))
                ret.append("      %-16s: %s" % (_("Memory"),    util.format_size(system.memory)))
                ret.append("")
-               ret.append("      %-16s: %s" % (_("Native arch"), system.arch))
+               ret.append("      %-16s: %s" % (_("Native arch"), system.native_arch))
+               if not system.arch == system.native_arch:
+                       ret.append("      %-16s: %s" % (_("Default arch"), system.arch))
 
                header = _("Supported arches")
                for arch in system.supported_arches:
index 446ee3b593afedfb11451a6564714760e18fc196..ade786eef7116f676ab469e5bb1c0f6aaa883aa8 100644 (file)
@@ -27,13 +27,14 @@ log = logging.getLogger("pakfire")
 
 from errors import ConfigError
 from repository import Repositories
+from system import system
 
 class Distribution(object):
        def __init__(self, pakfire, distro_config=None):
                self.pakfire = pakfire
 
                self._data = {
-                       "arch" : self.config.host_arch,
+                       "arch" : system.arch,
                        "name" : "unknown",
                        "slogan" : "---",
                        "vendor" : "unknown",
index 60b6ca081281936b0f74d80fc0c42fbf2d295dd5..8d99fb81554b7f1982a24e4e04b0f23ec4d24b8f 100644 (file)
@@ -36,12 +36,23 @@ class System(object):
        def hostname(self):
                return socket.gethostname()
 
+       @property
+       def native_arch(self):
+               """
+                       Return the native architecture of the host we
+                       are running on.
+               """
+               return os.uname()[4]
+
        @property
        def arch(self):
                """
                        Return the architecture of the host we are running on.
                """
-               return os.uname()[4]
+               if not self.native_arch in self.supported_arches:
+                       return self.supported_arches[0]
+
+               return self.native_arch
 
        @property
        def supported_arches(self):
@@ -58,12 +69,12 @@ class System(object):
                        # ARM
                        "armv5tel"  : ["armv5tel",],
                        "armv5tejl" : ["armv5tel",],
-                       "armv7l"    : ["armv5tel",],
+                       "armv7l"    : ["armv7hl", "armv5tel",],
                        "armv7hl"   : ["armv7hl", "armv5tel",],
                }
 
                try:
-                       return host_can_build[self.arch]
+                       return host_can_build[self.native_arch]
                except KeyError:
                        return []