diff options
author | Jürg Billeter <j@bitron.ch> | 2018-10-04 14:19:31 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-10-04 14:51:54 +0200 |
commit | 40106d81cac8d09427ac3e10789ebae77eb72f78 (patch) | |
tree | cd1f3fbde8c0b021423459f218543c8167e7295f | |
parent | fd6a957366e5abe3cddc225118969205000e182d (diff) | |
download | buildstream-juerg/remote.tar.gz |
element.py: Prepare local sandbox for bst checkout and bst shelljuerg/remote
A remote execution sandbox is not suitable for these commands.
-rw-r--r-- | buildstream/element.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index 9154f10e8..1d3a44f7b 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -1316,7 +1316,8 @@ class Element(Plugin): # @contextmanager def _prepare_sandbox(self, scope, directory, deps='run', integrate=True): - with self.__sandbox(directory, config=self.__sandbox_config) as sandbox: + # bst shell and bst checkout require a local sandbox. + with self.__sandbox(directory, config=self.__sandbox_config, allow_remote=False) as sandbox: # Configure always comes first, and we need it. self.configure_sandbox(sandbox) @@ -2147,17 +2148,18 @@ class Element(Plugin): # stdout (fileobject): The stream for stdout for the sandbox # stderr (fileobject): The stream for stderr for the sandbox # config (SandboxConfig): The SandboxConfig object + # allow_remote (bool): Whether the sandbox is allowed to be remote # # Yields: # (Sandbox): A usable sandbox # @contextmanager - def __sandbox(self, directory, stdout=None, stderr=None, config=None): + def __sandbox(self, directory, stdout=None, stderr=None, config=None, allow_remote=True): context = self._get_context() project = self._get_project() platform = Platform.get_platform() - if directory is not None and self.__use_remote_execution(): + if directory is not None and allow_remote and self.__use_remote_execution(): self.info("Using a remote sandbox for artifact {} with directory '{}'".format(self.name, directory)) @@ -2171,7 +2173,7 @@ class Element(Plugin): yield sandbox elif directory is not None and os.path.exists(directory): - if self.__remote_execution_url: + if allow_remote and self.__remote_execution_url: self.warn("Artifact {} is configured to use remote execution but element plugin does not support it." .format(self.name), detail="Element plugin '{kind}' does not support virtual directories." .format(kind=self.get_kind()), warning_token="remote-failure") @@ -2191,7 +2193,8 @@ class Element(Plugin): rootdir = tempfile.mkdtemp(prefix="{}-".format(self.normal_name), dir=context.builddir) # Recursive contextmanager... - with self.__sandbox(rootdir, stdout=stdout, stderr=stderr, config=config) as sandbox: + with self.__sandbox(rootdir, stdout=stdout, stderr=stderr, config=config, + allow_remote=allow_remote) as sandbox: yield sandbox # Cleanup the build dir |