diff options
author | Tom Pollard <tom.pollard@codethink.co.uk> | 2018-11-05 13:16:53 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-11-17 13:07:59 +0000 |
commit | 199bfff16160cd0c7c0fe56af3723656f6148068 (patch) | |
tree | 3e0107a4865292edf25e4bedfec6591f48e06b22 | |
parent | b5b79056acdc0ad883e04d17de5948fb4a9d88e6 (diff) | |
download | buildstream-199bfff16160cd0c7c0fe56af3723656f6148068.tar.gz |
Add cli main and user config option for 'pull-buildtrees' context.
_context.py: Add pull_buildtrees global user context, the default
of which is set to False via the addition of pull-buildtrees to
userconfig.yaml cache group.
_frontend/app.py & cli.py: Add --pull-buildtrees as a bst main
option, which when passed will override the default or user defined
context for pull_buildtrees.
tests/completions/completions.py: Update for the added flag.
-rw-r--r-- | buildstream/_context.py | 8 | ||||
-rw-r--r-- | buildstream/_frontend/app.py | 3 | ||||
-rw-r--r-- | buildstream/_frontend/cli.py | 2 | ||||
-rw-r--r-- | buildstream/data/userconfig.yaml | 3 | ||||
-rw-r--r-- | tests/completions/completions.py | 1 |
5 files changed, 15 insertions, 2 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py index 876b74712..960f37160 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -104,6 +104,9 @@ class Context(): # What to do when a build fails in non interactive mode self.sched_error_action = 'continue' + # Whether or not to attempt to pull build trees globally + self.pull_buildtrees = None + # Whether elements must be rebuilt when their dependencies have changed self._strict_build_plan = None @@ -178,13 +181,16 @@ class Context(): # our artifactdir - the artifactdir may not have been created # yet. cache = _yaml.node_get(defaults, Mapping, 'cache') - _yaml.node_validate(cache, ['quota']) + _yaml.node_validate(cache, ['quota', 'pull-buildtrees']) self.config_cache_quota = _yaml.node_get(cache, str, 'quota', default_value='infinity') # Load artifact share configuration self.artifact_cache_specs = ArtifactCache.specs_from_config_node(defaults) + # Load pull build trees configuration + self.pull_buildtrees = _yaml.node_get(cache, bool, 'pull-buildtrees') + # Load logging config logging = _yaml.node_get(defaults, Mapping, 'logging') _yaml.node_validate(logging, [ diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py index 6b292a44a..b42b94bc1 100644 --- a/buildstream/_frontend/app.py +++ b/buildstream/_frontend/app.py @@ -182,7 +182,8 @@ class App(): 'fetchers': 'sched_fetchers', 'builders': 'sched_builders', 'pushers': 'sched_pushers', - 'network_retries': 'sched_network_retries' + 'network_retries': 'sched_network_retries', + 'pull_buildtrees': 'pull_buildtrees' } for cli_option, context_attr in override_map.items(): option_value = self._main_options.get(cli_option) diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 85632959f..b75bf455b 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -219,6 +219,8 @@ def print_version(ctx, param, value): help="Specify a project option") @click.option('--default-mirror', default=None, help="The mirror to fetch from first, before attempting other mirrors") +@click.option('--pull-buildtrees', is_flag=True, default=None, + help="Include an element's build tree when pulling remote element artifacts") @click.pass_context def cli(context, **kwargs): """Build and manipulate BuildStream projects diff --git a/buildstream/data/userconfig.yaml b/buildstream/data/userconfig.yaml index efe419cfc..f540a97f6 100644 --- a/buildstream/data/userconfig.yaml +++ b/buildstream/data/userconfig.yaml @@ -35,6 +35,9 @@ cache: # to the isize of the file system containing the cache. quota: infinity + # Whether to pull build trees when downloading element artifacts + pull-buildtrees: False + # # Scheduler # diff --git a/tests/completions/completions.py b/tests/completions/completions.py index e6d15e68a..83728743a 100644 --- a/tests/completions/completions.py +++ b/tests/completions/completions.py @@ -42,6 +42,7 @@ MAIN_OPTIONS = [ "-o ", "--option ", "--on-error ", + "--pull-buildtrees ", "--pushers ", "--strict ", "--verbose ", |