summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2018-10-05 13:54:17 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2018-10-05 13:54:17 +0000
commitd3921ab8bd515fb3dc890c831b7fb33d34d6de05 (patch)
tree94cfe118108d6c46426e7dd3197233f4cee9fb4c
parentb38f9f9dc112641f9c1d9b5bb1f4aaddc2fba6b4 (diff)
parent47df1e364aef143e0f6fa18f5468f41733042a48 (diff)
downloadbuildstream-d3921ab8bd515fb3dc890c831b7fb33d34d6de05.tar.gz
Merge branch 'juerg/remote' into 'master'
element.py: Prepare local sandbox for bst checkout and bst shell See merge request BuildStream/buildstream!860
-rw-r--r--buildstream/element.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 25ef22ed2..aff185405 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)
@@ -2149,17 +2150,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))
@@ -2173,7 +2175,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")
@@ -2193,7 +2195,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