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 16:19:50 +0000 |
commit | 633911efc36768c5587855157171b0aff6385bbd (patch) | |
tree | bc88211601d0af0a516aa3fb4d98164a5cfb5926 | |
parent | c351a3a7a03f68cedc634044b837fb301bb8c103 (diff) | |
download | buildstream-633911efc36768c5587855157171b0aff6385bbd.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 5d083ee84..d7338904b 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)") @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. |