diff options
author | Gökçen Nurlu <gnurlu1@bloomberg.net> | 2018-10-25 18:30:36 +0100 |
---|---|---|
committer | Gökçen Nurlu <gnurlu1@bloomberg.net> | 2018-10-25 18:34:44 +0100 |
commit | 10ebb52f5a8313e6784b9abe1ed31a0ead14c4ff (patch) | |
tree | a5105eb3a477a9830795e7feda886f3ab4266936 | |
parent | 552f5fc69c8773726acc5a8c0997cd73341fa7f7 (diff) | |
download | buildstream-10ebb52f5a8313e6784b9abe1ed31a0ead14c4ff.tar.gz |
Add explicit fetch flag for 'bst pull' command
-rw-r--r-- | buildstream/_frontend/cli.py | 6 | ||||
-rw-r--r-- | buildstream/_stream.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 85632959f..f93dca400 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -431,8 +431,10 @@ def track(app, elements, deps, except_, cross_junctions): help="The URL of the remote cache (defaults to the first configured cache)") @click.argument('elements', nargs=-1, type=click.Path(readable=False)) +@click.option('--fetch', 'fetch_', default=False, is_flag=True, + help="Enable auto-fetching of junction(s) automatically if element has dependencies") @click.pass_obj -def pull(app, elements, deps, remote): +def pull(app, elements, deps, remote, fetch_): """Pull a built artifact from the configured remote artifact cache. By default the artifact will be pulled one of the configured caches @@ -446,7 +448,7 @@ def pull(app, elements, deps, remote): all: All dependencies """ with app.initialized(session_name="Pull"): - app.stream.pull(elements, selection=deps, remote=remote) + app.stream.pull(elements, selection=deps, remote=remote, fetch_subprojects=fetch_) ################################################################## diff --git a/buildstream/_stream.py b/buildstream/_stream.py index e7a71978b..6f4369506 100644 --- a/buildstream/_stream.py +++ b/buildstream/_stream.py @@ -289,13 +289,15 @@ class Stream(): # targets (list of str): Targets to pull # selection (PipelineSelection): The selection mode for the specified targets # remote (str): The URL of a specific remote server to pull from, or None + # fetch_subprojects (bool): Flag to enable auto-fetch of junctions if they are needed by `targets` # # If `remote` specified as None, then regular configuration will be used # to determine where to pull artifacts from. # def pull(self, targets, *, selection=PipelineSelection.NONE, - remote=None): + remote=None, + fetch_subprojects): use_config = True if remote: @@ -305,7 +307,7 @@ class Stream(): selection=selection, use_artifact_config=use_config, artifact_remote_url=remote, - fetch_subprojects=True) + fetch_subprojects=fetch_subprojects) if not self._artifacts.has_fetch_remotes(): raise StreamError("No artifact caches available for pulling artifacts") |