diff options
author | Jürg Billeter <j@bitron.ch> | 2020-02-20 17:39:09 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-02-27 12:18:07 +0100 |
commit | 6b77daa40a2a07d2eb16fbcf6cafa1f2ce229114 (patch) | |
tree | 7927a74dbf061c6c7649a6ed98f680dfb276e7e8 /src | |
parent | e76ee5796f0eea0e4a0fc9d892b0272fab0885f2 (diff) | |
download | buildstream-6b77daa40a2a07d2eb16fbcf6cafa1f2ce229114.tar.gz |
Canonicalize OS name
This matches the REAPI platform lexicon.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_platform/platform.py | 8 | ||||
-rw-r--r-- | src/buildstream/element.py | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/buildstream/_platform/platform.py b/src/buildstream/_platform/platform.py index c838ef6c2..e0a0cf7ce 100644 --- a/src/buildstream/_platform/platform.py +++ b/src/buildstream/_platform/platform.py @@ -138,7 +138,13 @@ class Platform: @staticmethod def get_host_os(): - return platform.uname().system + system = platform.uname().system.lower() + + if system == "darwin" and platform.mac_ver()[0]: + # mac_ver() returns a non-empty release string on macOS. + return "macos" + else: + return system # canonicalize_arch(): # diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 071d085b8..f270bd8cc 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -2721,6 +2721,12 @@ class Element(Plugin): # Sandbox config, unlike others, has fixed members so we should validate them sandbox_config.validate_keys(["build-uid", "build-gid", "build-os", "build-arch"]) + build_os = sandbox_config.get_str("build-os", default=None) + if build_os: + build_os = build_os.lower() + else: + build_os = host_os + build_arch = sandbox_config.get_str("build-arch", default=None) if build_arch: build_arch = Platform.canonicalize_arch(build_arch) @@ -2728,10 +2734,7 @@ class Element(Plugin): build_arch = host_arch return SandboxConfig( - sandbox_config.get_int("build-uid"), - sandbox_config.get_int("build-gid"), - sandbox_config.get_str("build-os", default=host_os), - build_arch, + sandbox_config.get_int("build-uid"), sandbox_config.get_int("build-gid"), build_os, build_arch, ) # This makes a special exception for the split rules, which |