diff options
author | Jürg Billeter <j@bitron.ch> | 2018-09-26 09:13:37 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-09-27 10:18:03 +0100 |
commit | f9494f1fa9781df22606eaa43ea58c1395e1b337 (patch) | |
tree | d77045a83222ce1de3dbe4182a70315047c8de0f /buildstream | |
parent | f8bbe00878ba21b623c593673b1dee11584ca2a6 (diff) | |
download | buildstream-f9494f1fa9781df22606eaa43ea58c1395e1b337.tar.gz |
element.py: Validate sandbox config
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/element.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index 55e402a95..320ba7a8a 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -246,15 +246,23 @@ class Element(Plugin): self.__config = self.__extract_config(meta) self._configure(self.__config) - # Extract Sandbox config - self.__sandbox_config = self.__extract_sandbox_config(meta) - # Extract remote execution URL if not self.__is_junction: self.__remote_execution_url = project.remote_execution_url else: self.__remote_execution_url = None + # Extract Sandbox config + self.__sandbox_config = self.__extract_sandbox_config(meta) + + self.__sandbox_config_supported = True + if not self.__use_remote_execution(): + 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 @@ -1521,6 +1529,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) @@ -2110,7 +2123,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 |