summaryrefslogtreecommitdiff
path: root/buildstream/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/element.py')
-rw-r--r--buildstream/element.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index d7072dc8c..2f724f49d 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -438,7 +438,7 @@ class Element(Plugin):
visited=visited, recursed=True)
# Yeild self only at the end, after anything needed has been traversed
- if should_yield and (recurse or recursed) and (scope in (Scope.ALL, Scope.RUN)):
+ if should_yield and (recurse or recursed) and scope != Scope.BUILD:
yield self
def search(self, scope, name):
@@ -1339,7 +1339,7 @@ class Element(Plugin):
# is used to stage things by the `bst checkout` codepath
#
@contextmanager
- def _prepare_sandbox(self, scope, directory, deps='run', integrate=True):
+ def _prepare_sandbox(self, scope, directory, shell=False, integrate=True):
# bst shell and bst checkout require a local sandbox.
bare_directory = True if directory else False
with self.__sandbox(directory, config=self.__sandbox_config, allow_remote=False,
@@ -1350,20 +1350,19 @@ class Element(Plugin):
# Stage something if we need it
if not directory:
- if scope == Scope.BUILD:
+ if shell and scope == Scope.BUILD:
self.stage(sandbox)
- elif scope == Scope.RUN:
+ else:
# Stage deps in the sandbox root
- if deps == 'run':
- with self.timed_activity("Staging dependencies", silent_nested=True):
- self.stage_dependency_artifacts(sandbox, scope)
+ with self.timed_activity("Staging dependencies", silent_nested=True):
+ self.stage_dependency_artifacts(sandbox, scope)
- # Run any integration commands provided by the dependencies
- # once they are all staged and ready
- if integrate:
- with self.timed_activity("Integrating sandbox"):
- for dep in self.dependencies(scope):
- dep.integrate(sandbox)
+ # Run any integration commands provided by the dependencies
+ # once they are all staged and ready
+ if integrate:
+ with self.timed_activity("Integrating sandbox"):
+ for dep in self.dependencies(scope):
+ dep.integrate(sandbox)
yield sandbox
@@ -1858,7 +1857,7 @@ class Element(Plugin):
# If directory is not specified, one will be staged using scope
def _shell(self, scope=None, directory=None, *, mounts=None, isolate=False, prompt=None, command=None):
- with self._prepare_sandbox(scope, directory) as sandbox:
+ with self._prepare_sandbox(scope, directory, shell=True) as sandbox:
environment = self.get_environment()
environment = copy.copy(environment)
flags = SandboxFlags.INTERACTIVE | SandboxFlags.ROOT_READ_ONLY