From: Michael Tremer Date: Sun, 29 Jan 2012 11:36:30 +0000 (+0100) Subject: Make a better selection of architectures. X-Git-Tag: 0.9.20~16^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=790a44cc90dea540c91acab43c1ec42f53f75027;p=pakfire.git Make a better selection of architectures. If a system does not support one architecture natively, we are going to select the best available architecture. --- diff --git a/python/pakfire/cli.py b/python/pakfire/cli.py index bdb564a81..6d19e97fc 100644 --- a/python/pakfire/cli.py +++ b/python/pakfire/cli.py @@ -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: diff --git a/python/pakfire/distro.py b/python/pakfire/distro.py index 446ee3b59..ade786eef 100644 --- a/python/pakfire/distro.py +++ b/python/pakfire/distro.py @@ -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", diff --git a/python/pakfire/system.py b/python/pakfire/system.py index 60b6ca081..8d99fb815 100644 --- a/python/pakfire/system.py +++ b/python/pakfire/system.py @@ -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 []