Skip to content
Snippets Groups Projects
Commit 0844d4ad authored by Sjoerd Simons's avatar Sjoerd Simons
Browse files

Sort out the various machine type names


We're using four different ways to define the achitecture. There is the
machine name as given by e.g. uname -m, the dpkg architectures (armhf,
amd64, etc) and finally the gnu arch triplet (e.g. aarch64-linux-gnu).
Have TargetTriplet recognize all three and properties for all three
variants.

Signed-off-by: default avatarSjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: default avatarGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D5253
parent 61cf0495
No related branches found
No related tags found
No related merge requests found
...@@ -134,16 +134,17 @@ class Colors: ...@@ -134,16 +134,17 @@ class Colors:
class TargetTriplet: class TargetTriplet:
SUPPORTED = { # Machine name, dpkg architecture, gnu triplet
'armhf': "arm-linux-gnueabihf", SUPPORTED = [
'arm64': "aarch64-linux-gnu", [ 'armv7l', "armhf", "arm-linux-gnueabihf" ],
'x86_64': "x86_64-linux-gnu" [ 'aarch64',"arm64", "aarch64-linux-gnu" ],
} [ 'x86_64', "amd64", "x86_64-linux-gnu" ],
]
def __init__(self, string): def __init__(self, string):
for items in self.SUPPORTED.items(): for items in self.SUPPORTED:
if string in items: if string in items:
self.arch, self.triplet = items self.machine, self.arch, self.triplet = items
return return
raise NotSupportedError raise NotSupportedError
...@@ -208,9 +209,11 @@ class Device: ...@@ -208,9 +209,11 @@ class Device:
print(e) print(e)
raise InvalidDeviceError("No image_version file found") raise InvalidDeviceError("No image_version file found")
a = self._exec('uname', '-m') a = self._exec('uname', '-m')
if a not in TargetTriplet.SUPPORTED: try:
triplet = TargetTriplet (a)
except NotSupportedError:
raise InvalidDeviceError("Unsupported architecture {}".format(a)) raise InvalidDeviceError("Unsupported architecture {}".format(a))
self.version.arch = a self.version.arch = triplet.arch
class SysrootVersion: class SysrootVersion:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment