From 920674525871fca62464c68b66a8ffedcf6706c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6k=C3=A7en=20Nurlu?= Date: Thu, 25 Oct 2018 18:30:36 +0100 Subject: Add no-fetch flag for 'bst pull' command --- buildstream/_frontend/cli.py | 6 ++++-- buildstream/_stream.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index b1b4e03b0..99054fe74 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -433,8 +433,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('--no-fetch', 'no_fetch', default=False, is_flag=True, + help="Disable auto-fetching of junction(s) automatically") @click.pass_obj -def pull(app, elements, deps, remote): +def pull(app, elements, deps, remote, no_fetch): """Pull a built artifact from the configured remote artifact cache. By default the artifact will be pulled one of the configured caches @@ -448,7 +450,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, no_fetch=no_fetch) ################################################################## diff --git a/buildstream/_stream.py b/buildstream/_stream.py index 76f1d67aa..992b37ad5 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 + # no_fetch (bool): Flag to disable auto-fetch of junctions 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, + no_fetch): 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=not no_fetch) if not self._artifacts.has_fetch_remotes(): raise StreamError("No artifact caches available for pulling artifacts") -- cgit v1.2.1