diff options
author | Gökçen Nurlu <gnurlu1@bloomberg.net> | 2018-10-29 11:37:46 +0000 |
---|---|---|
committer | Gökçen Nurlu <gnurlu1@bloomberg.net> | 2018-11-23 11:49:57 +0000 |
commit | a45a40ffd2f57346a5215a6ece59509bf31d4057 (patch) | |
tree | aacb39c713f68b0063a4008999354616619bca6f | |
parent | e00c5bc1b9f7c58b027536fb8f96ca9edc5ef70d (diff) | |
download | buildstream-a45a40ffd2f57346a5215a6ece59509bf31d4057.tar.gz |
Add no-fetch flag for 'bst source-bundle'
-rw-r--r-- | buildstream/_frontend/cli.py | 7 | ||||
-rw-r--r-- | buildstream/_stream.py | 14 |
2 files changed, 16 insertions, 5 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 228a41648..04bcca093 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -849,9 +849,11 @@ def workspace_list(app): help="The directory to write the tarball to") @click.argument('element', 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 source_bundle(app, element, force, directory, - track_, compression, except_): + track_, compression, except_, no_fetch): """Produce a source bundle to be manually executed """ with app.initialized(): @@ -859,4 +861,5 @@ def source_bundle(app, element, force, directory, track_first=track_, force=force, compression=compression, - except_targets=except_) + except_targets=except_, + no_fetch=no_fetch) diff --git a/buildstream/_stream.py b/buildstream/_stream.py index 2e88d5a59..bf0e66f43 100644 --- a/buildstream/_stream.py +++ b/buildstream/_stream.py @@ -729,12 +729,15 @@ class Stream(): # track_first (bool): Track new source references before bundling # compression (str): The compression type to use # force (bool): Overwrite an existing tarball + # no_fetch (bool): Flag to disable auto-fetch of `target` and junction(s) + # needed by `target` # def source_bundle(self, target, directory, *, track_first=False, force=False, compression="gz", - except_targets=()): + except_targets=(), + no_fetch): if track_first: track_targets = (target,) @@ -745,7 +748,7 @@ class Stream(): selection=PipelineSelection.ALL, except_targets=except_targets, track_selection=PipelineSelection.ALL, - fetch_subprojects=True) + fetch_subprojects=not no_fetch) # source-bundle only supports one target target = self.targets[0] @@ -770,7 +773,12 @@ class Stream(): # Fetch and possibly track first # - self._fetch(elements, track_elements=track_elements) + if not no_fetch: + self._fetch(elements, track_elements=track_elements) + else: + # No fetch, just tracking + self._fetch([], track_elements=track_elements) + self._pipeline.assert_sources_cached(elements) # We don't use the scheduler for this as it is almost entirely IO # bound. |