diff options
author | Jürg Billeter <j@bitron.ch> | 2018-09-26 09:13:37 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-14 16:25:19 +0900 |
commit | c2f572f10c1bcde00ee800a0bfa1f8a7b1911135 (patch) | |
tree | 3dd4be025cca620d9440875a79244d6b7206ae34 | |
parent | 6676dfdd47247004eaca73a0861e89d246292bcf (diff) | |
download | buildstream-c2f572f10c1bcde00ee800a0bfa1f8a7b1911135.tar.gz |
element.py: Validate sandbox config
-rw-r--r-- | buildstream/element.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index 7be27cb2a..898ff0784 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -269,6 +269,16 @@ class Element(Plugin): # Extract Sandbox config self.__sandbox_config = self.__extract_sandbox_config(meta) + # Extract Sandbox config + self.__sandbox_config = self.__extract_sandbox_config(meta) + + self.__sandbox_config_supported = True + platform = Platform.get_platform() + if not platform.check_sandbox_config(self.__sandbox_config): + # Local sandbox does not fully support specified sandbox config. + # This will taint the artifact, disable pushing. + self.__sandbox_config_supported = False + def __lt__(self, other): return self.name < other.name @@ -1483,6 +1493,11 @@ class Element(Plugin): context = self._get_context() with self._output_file() as output_file: + if not self.__sandbox_config_supported: + self.warn("Sandbox configuration is not supported by the platform.", + detail="Falling back to UID {} GID {}. Artifact will not be pushed." + .format(self.__sandbox_config.build_uid, self.__sandbox_config.build_gid)) + # Explicitly clean it up, keep the build dir around if exceptions are raised os.makedirs(context.builddir, exist_ok=True) rootdir = tempfile.mkdtemp(prefix="{}-".format(self.normal_name), dir=context.builddir) @@ -2042,7 +2057,8 @@ class Element(Plugin): workspaced_dependencies = self.__get_artifact_metadata_workspaced_dependencies() # Other conditions should be or-ed - self.__tainted = workspaced or workspaced_dependencies + self.__tainted = (workspaced or workspaced_dependencies or + not self.__sandbox_config_supported) return self.__tainted |