summaryrefslogtreecommitdiff
path: root/buildstream/element.py
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2018-09-26 00:30:17 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2018-12-03 09:46:13 +0000
commit1b24148fdadcafaf4b316cc45819a06d8ec42647 (patch)
tree3940bd30844326b19150f9db0926697dab07fd2b /buildstream/element.py
parent87ba19d77393bce1bcc03df36a12e91010500451 (diff)
downloadbuildstream-1b24148fdadcafaf4b316cc45819a06d8ec42647.tar.gz
Ensure `--deps=none` option works for `bst checkout`
Currently, `bst checkout --deps none` command always produces empty output. Fix this issue and add regression test for the same. - element_enums.py: Add Scope.NONE. - element.py: Ensure Scope.NONE works correctly in addition to Scope.RUN/Scope.ALL in Element.dependencies() and Element.search(). - tests/frontend/buildcheckout.py: Fix tests for `--deps none`. Fixes #670.
Diffstat (limited to 'buildstream/element.py')
-rw-r--r--buildstream/element.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index d7072dc8c..d94f2e8ad 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):
@@ -1353,17 +1353,21 @@ class Element(Plugin):
if scope == Scope.BUILD:
self.stage(sandbox)
elif scope == Scope.RUN:
- # Stage deps in the sandbox root
if deps == 'run':
- 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)
+ dependency_scope = Scope.RUN
+ else:
+ dependency_scope = Scope.NONE
+
+ # Stage deps in the sandbox root
+ with self.timed_activity("Staging dependencies", silent_nested=True):
+ self.stage_dependency_artifacts(sandbox, dependency_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(dependency_scope):
+ dep.integrate(sandbox)
yield sandbox