diff --git a/buildstream/_options/optionarch.py b/buildstream/_options/optionarch.py index 13a691643b33de1ec3fadfecf253cacb2b8efaf5..1d8509cf202e4af1ed233a9436e123002e1180e8 100644 --- a/buildstream/_options/optionarch.py +++ b/buildstream/_options/optionarch.py @@ -17,7 +17,7 @@ # Authors: # Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> -import os +from .._platform import Platform from .optionenum import OptionEnum @@ -41,8 +41,7 @@ class OptionArch(OptionEnum): super(OptionArch, self).load(node, allow_default_definition=False) def load_default_value(self, node): - _, _, _, _, machine_arch = os.uname() - return machine_arch + return Platform.get_host_arch() def resolve(self): diff --git a/doc/examples/flatpak-autotools/elements/base/sdk.bst b/doc/examples/flatpak-autotools/elements/base/sdk.bst index a1b6c585693f6d6e8ce73a688d5842c4c76dc929..97089b83b61b28bf0a669599a5ef4fc844f5b094 100644 --- a/doc/examples/flatpak-autotools/elements/base/sdk.bst +++ b/doc/examples/flatpak-autotools/elements/base/sdk.bst @@ -5,10 +5,10 @@ sources: url: gnomesdk:repo/ gpg-key: keys/gnome-sdk.gpg (?): - - arch == "x86_64": + - arch == "x86-64": track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 - - arch == "i386": + - arch == "x86-32": track: runtime/org.freedesktop.BaseSdk/i386/1.4 ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 config: diff --git a/doc/examples/flatpak-autotools/project.conf b/doc/examples/flatpak-autotools/project.conf index 0296b22f68d2ce659be3fa097f55b378e4083666..401dc561aef55ac5a78b6410ce99b376257f3134 100644 --- a/doc/examples/flatpak-autotools/project.conf +++ b/doc/examples/flatpak-autotools/project.conf @@ -10,6 +10,6 @@ options: type: arch description: The machine architecture values: - - x86_64 - - i386 + - x86-64 + - x86-32 diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py index 113f5bab0e8fc2d766431022cfda133f89acf4e1..c278b9ca9d01eb34105b4d1e3d661512479c3d94 100644 --- a/tests/cachekey/cachekey.py +++ b/tests/cachekey/cachekey.py @@ -144,7 +144,7 @@ DATA_DIR = os.path.join( # The cache key test uses a project which exercises all plugins, # so we cant run it at all if we dont have them installed. # -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', reason='Cache keys depend on architecture') @pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') @pytest.mark.skipif(HAVE_BZR is False, reason="bzr is not available") diff --git a/tests/examples/autotools.py b/tests/examples/autotools.py index e7ca8c5e9eadcec2d103f79ea93c466956a8856a..8e4bf5a75bd1cae22f0fcd6723646d55cc35926c 100644 --- a/tests/examples/autotools.py +++ b/tests/examples/autotools.py @@ -13,8 +13,8 @@ DATA_DIR = os.path.join( # Tests a build of the autotools amhello project on a alpine-linux base runtime -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_autotools_build(cli, tmpdir, datafiles): @@ -38,8 +38,8 @@ def test_autotools_build(cli, tmpdir, datafiles): # Test running an executable built with autotools. -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_autotools_run(cli, tmpdir, datafiles): diff --git a/tests/examples/developing.py b/tests/examples/developing.py index 4bb7076c55c007365ae1d6d29ad430bc78bcfd52..0a51802a970bbf0c6d68c4f863d4039bd4a346c9 100644 --- a/tests/examples/developing.py +++ b/tests/examples/developing.py @@ -14,8 +14,8 @@ DATA_DIR = os.path.join( # Test that the project builds successfully -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_autotools_build(cli, tmpdir, datafiles): @@ -37,8 +37,8 @@ def test_autotools_build(cli, tmpdir, datafiles): # Test the unmodified hello command works as expected. -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_run_unmodified_hello(cli, tmpdir, datafiles): @@ -70,8 +70,8 @@ def test_open_workspace(cli, tmpdir, datafiles): # Test making a change using the workspace -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_make_change_in_workspace(cli, tmpdir, datafiles): diff --git a/tests/examples/flatpak-autotools.py b/tests/examples/flatpak-autotools.py index dbaf522a29655529c515f25c5b7808216e1ba447..73910c5eb439a4e8da855f2f40009d64df3ee175 100644 --- a/tests/examples/flatpak-autotools.py +++ b/tests/examples/flatpak-autotools.py @@ -32,8 +32,8 @@ def workaround_setuptools_bug(project): # Test that a build upon flatpak runtime 'works' - we use the autotools sample # amhello project for this. -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE, reason='Only available on linux with ostree') @pytest.mark.datafiles(DATA_DIR) def test_autotools_build(cli, tmpdir, datafiles): @@ -57,8 +57,8 @@ def test_autotools_build(cli, tmpdir, datafiles): # Test running an executable built with autotools -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE, reason='Only available on linux with ostree') @pytest.mark.datafiles(DATA_DIR) def test_autotools_run(cli, tmpdir, datafiles): diff --git a/tests/examples/integration-commands.py b/tests/examples/integration-commands.py index f4b0405e0f65124f6420e77ca88357470b02ab67..71e383008a7c9e8c5e838b4bab4edf43e8afa5f7 100644 --- a/tests/examples/integration-commands.py +++ b/tests/examples/integration-commands.py @@ -12,8 +12,8 @@ DATA_DIR = os.path.join( ) -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_integration_commands_build(cli, tmpdir, datafiles): @@ -25,8 +25,8 @@ def test_integration_commands_build(cli, tmpdir, datafiles): # Test running the executable -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_integration_commands_run(cli, tmpdir, datafiles): diff --git a/tests/examples/junctions.py b/tests/examples/junctions.py index 97c622bbd7b2e9fb8a14a151d9ca47c078533589..753fa2dc0a0dfb0658e5946c003ef0aa32e9b8b1 100644 --- a/tests/examples/junctions.py +++ b/tests/examples/junctions.py @@ -13,8 +13,8 @@ DATA_DIR = os.path.join( # Test that the project builds successfully -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_build(cli, tmpdir, datafiles): @@ -25,8 +25,8 @@ def test_build(cli, tmpdir, datafiles): # Test the callHello script works as expected. -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_shell_call_hello(cli, tmpdir, datafiles): diff --git a/tests/examples/running-commands.py b/tests/examples/running-commands.py index 3e679f9c2981b3f4e219472839e3793078ad2072..61e23fd9c8a264036e9325f7fcbf9bd479ac2a0e 100644 --- a/tests/examples/running-commands.py +++ b/tests/examples/running-commands.py @@ -12,8 +12,8 @@ DATA_DIR = os.path.join( ) -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_running_commands_build(cli, tmpdir, datafiles): @@ -25,8 +25,8 @@ def test_running_commands_build(cli, tmpdir, datafiles): # Test running the executable -@pytest.mark.skipif(MACHINE_ARCH != 'x86_64', - reason='Examples are writtent for x86_64') +@pytest.mark.skipif(MACHINE_ARCH != 'x86-64', + reason='Examples are writtent for x86-64') @pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap') @pytest.mark.datafiles(DATA_DIR) def test_running_commands_run(cli, tmpdir, datafiles): diff --git a/tests/format/list-directive-type-error/project.conf b/tests/format/list-directive-type-error/project.conf index 1dd0f1b0a384f97f5324d6271468d1e5a358285c..79f73402bd591148cc103ba9a3b163a3994109b5 100644 --- a/tests/format/list-directive-type-error/project.conf +++ b/tests/format/list-directive-type-error/project.conf @@ -4,4 +4,4 @@ options: arch: type: arch description: Example architecture option - values: [ x86_32, x86_64, aarch64 ] + values: [ x86-32, x86-64, aarch64 ] \ No newline at end of file diff --git a/tests/format/option-arch/element.bst b/tests/format/option-arch/element.bst index 4da01d8891f5650ce440ca9044b55db5a71068e2..2528d9170d946683f441237b28fa101dc0c85173 100644 --- a/tests/format/option-arch/element.bst +++ b/tests/format/option-arch/element.bst @@ -2,7 +2,7 @@ kind: autotools variables: result: "Nothing" (?): - - machine_arch == "arm": + - machine_arch == "aarch32": result: "Army" - machine_arch == "aarch64": result: "Aarchy" diff --git a/tests/format/option-arch/project.conf b/tests/format/option-arch/project.conf index a2c3ddf9aa1d8f9b8ebb7ad62bac6cf6200e3973..8b94232cf0c5b00fc3bab7e15c82ea49df8da0f8 100644 --- a/tests/format/option-arch/project.conf +++ b/tests/format/option-arch/project.conf @@ -5,5 +5,5 @@ options: type: arch description: The machine architecture values: - - arm + - aarch32 - aarch64 diff --git a/tests/format/optionarch.py b/tests/format/optionarch.py index 4c126aa871d3b42b2daa7f297039cdee9e846e63..901b6e2da6fd2b41774bc0d8d1706e59824c4ef4 100644 --- a/tests/format/optionarch.py +++ b/tests/format/optionarch.py @@ -29,7 +29,7 @@ def override_uname_arch(name): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("uname,value,expected", [ # Test explicitly provided arches - ('arm', 'arm', 'Army'), + ('arm', 'aarch32', 'Army'), ('arm', 'aarch64', 'Aarchy'), # Test automatically derived arches @@ -38,7 +38,7 @@ def override_uname_arch(name): # Test that explicitly provided arches dont error out # when the `uname` reported arch is not supported - ('i386', 'arm', 'Army'), + ('i386', 'aarch32', 'Army'), ('x86_64', 'aarch64', 'Aarchy'), ]) def test_conditional(cli, datafiles, uname, value, expected): diff --git a/tests/integration/base/generate-base.sh b/tests/integration/base/generate-base.sh index d1ebd58ae2e979084a23a6392d9d266dd520cfd5..338c6d98fe527ee34e2418c5c97f5b2c5ce0d2ce 100755 --- a/tests/integration/base/generate-base.sh +++ b/tests/integration/base/generate-base.sh @@ -9,7 +9,7 @@ set -eux -ALPINE_ARCH=${ARCH:-x86_64} +ALPINE_ARCH=${ARCH:-x86-64} ALPINE_BASE=http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/${ALPINE_ARCH}/alpine-minirootfs-3.7.0-${ALPINE_ARCH}.tar.gz mkdir root diff --git a/tests/integration/project/elements/base/base-alpine.bst b/tests/integration/project/elements/base/base-alpine.bst index dd5ee7d882fe8c1b60857641b53b3bb6407d9964..c5833095dead7beae8074128634a0904d63f0525 100644 --- a/tests/integration/project/elements/base/base-alpine.bst +++ b/tests/integration/project/elements/base/base-alpine.bst @@ -9,7 +9,7 @@ sources: - kind: tar base-dir: '' (?): - - arch == "x86_64": + - arch == "x86-64": ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639 url: "alpine:integration-tests-base.v1.x86_64.tar.xz" - arch == "aarch64": diff --git a/tests/integration/project/project.conf b/tests/integration/project/project.conf index e0475539aebe848f282290d1baeee855e8b268ac..726f656860cc1e9352bf88f557fbaf32b22dff9e 100644 --- a/tests/integration/project/project.conf +++ b/tests/integration/project/project.conf @@ -13,7 +13,7 @@ options: type: arch description: Current architecture values: - - x86_64 + - x86-64 - aarch64 split-rules: test: diff --git a/tests/testutils/site.py b/tests/testutils/site.py index 6c286e7208b1ae1000b4a3cf36a6a093b7a11bec..c7625cccf14362ea2ec7d26d226e472eca28488c 100644 --- a/tests/testutils/site.py +++ b/tests/testutils/site.py @@ -5,6 +5,7 @@ import os import sys from buildstream import _site, utils, ProgramNotFoundError +from buildstream._platform import Platform try: utils.get_host_tool('bzr') @@ -52,4 +53,4 @@ except ImportError: IS_LINUX = os.getenv('BST_FORCE_BACKEND', sys.platform).startswith('linux') -_, _, _, _, MACHINE_ARCH = os.uname() +MACHINE_ARCH = Platform.get_host_arch()