summaryrefslogtreecommitdiff
path: root/buildstream/element.py
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2018-11-22 16:51:51 +0000
committerRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2018-12-05 10:44:02 +0000
commit1ad35fcd1bbb4a89e177da44303cf95e5a3b659d (patch)
tree0a35f937c2f1a3dce96b40f2ee2fd51b33d9be35 /buildstream/element.py
parent2f5966bdf5bdc6bbd6db46a7e41c93b32c1d6deb (diff)
downloadbuildstream-1ad35fcd1bbb4a89e177da44303cf95e5a3b659d.tar.gz
_config.py: Use os and architecture settings
In element, platform asks for host os and architecture to default to when SandboxConfig is initialised. This changes element cache keys so those have been updated in the tests.
Diffstat (limited to 'buildstream/element.py')
-rw-r--r--buildstream/element.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 2f724f49d..27677b054 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -2410,6 +2410,11 @@ class Element(Plugin):
project.ensure_fully_loaded()
sandbox_config = _yaml.node_chain_copy(project._sandbox)
+ # Get the platform to ask for host architecture
+ platform = Platform.get_platform()
+ host_arch = platform.get_host_arch()
+ host_os = platform.get_host_os()
+
# The default config is already composited with the project overrides
sandbox_defaults = _yaml.node_get(self.__defaults, Mapping, 'sandbox', default_value={})
sandbox_defaults = _yaml.node_chain_copy(sandbox_defaults)
@@ -2419,10 +2424,13 @@ class Element(Plugin):
_yaml.node_final_assertions(sandbox_config)
# Sandbox config, unlike others, has fixed members so we should validate them
- _yaml.node_validate(sandbox_config, ['build-uid', 'build-gid'])
+ _yaml.node_validate(sandbox_config, ['build-uid', 'build-gid', 'build-os', 'build-arch'])
- return SandboxConfig(self.node_get_member(sandbox_config, int, 'build-uid'),
- self.node_get_member(sandbox_config, int, 'build-gid'))
+ return SandboxConfig(
+ self.node_get_member(sandbox_config, int, 'build-uid'),
+ self.node_get_member(sandbox_config, int, 'build-gid'),
+ self.node_get_member(sandbox_config, str, 'build-os', default=host_os),
+ self.node_get_member(sandbox_config, str, 'build-arch', default=host_arch))
# This makes a special exception for the split rules, which
# elements may extend but whos defaults are defined in the project.