summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-05-07 16:50:20 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-05-08 03:59:38 +0900
commit1ec80edc1e80bf03b5eeca500d62da64977a24dd (patch)
treef6c7502dae752d0d02474c9e1676c5fce0e84ba3
parent5bdc0a79d1fb67d2da552a902163dec450ff292c (diff)
downloadbuildstream-tristan/pipeline-refactor.tar.gz
_frontend/cli.py: Fetch all elements when tracking a build plantristan/pipeline-refactor
It makes not sense to type `bst fetch --track --deps all <targets>`, because tracking will inevitably modify the build plan. Stream initialization will not cope with this either, instead of silently doing something which does not make any sense, we add an assertion that this should not happen. Unfortunately since `plan` is the default deps type for `bst fetch`, this is likely to happen so it's important to correct. This patch adds a warning in the case tracking of the build plan elements is requested, and converts the request to track all elements instead.
-rw-r--r--buildstream/_frontend/cli.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py
index 2b5c77f8a..41736ac2f 100644
--- a/buildstream/_frontend/cli.py
+++ b/buildstream/_frontend/cli.py
@@ -275,10 +275,17 @@ def fetch(app, elements, deps, track_, except_, track_cross_junctions):
plan: Only dependencies required for the build plan
all: All dependencies
"""
+ from .._pipeline import PipelineSelection
+
if track_cross_junctions and not track_:
click.echo("ERROR: The --track-cross-junctions option can only be used with --track", err=True)
sys.exit(-1)
+ if track_ and deps == PipelineSelection.PLAN:
+ click.echo("WARNING: --track specified for tracking of a build plan\n\n"
+ "Since tracking modifies the build plan, all elements will be tracked.", err=True)
+ deps = PipelineSelection.ALL
+
with app.initialized(session_name="Fetch"):
app.stream.fetch(elements,
selection=deps,