summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-27 21:18:15 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-27 21:18:15 +0900
commitcf1a2d326af47e0cdf49cd99d1e4447f494de231 (patch)
tree0cc913f9bde6cab357b46ad27b363ab00b8424cd
parent6976ba5d8c222aee61bfd5666b5df1b07f76b9bd (diff)
downloadbuildstream-cf1a2d326af47e0cdf49cd99d1e4447f494de231.tar.gz
context.py: Moving strict mode configuration to be project specific
-rw-r--r--buildstream/context.py30
-rw-r--r--buildstream/data/userconfig.yaml19
2 files changed, 22 insertions, 27 deletions
diff --git a/buildstream/context.py b/buildstream/context.py
index 68498e1dd..fb2e074a2 100644
--- a/buildstream/context.py
+++ b/buildstream/context.py
@@ -59,7 +59,7 @@ class Context():
self.target_arch = target_arch or host_arch
"""The machine on which the results of the build should execute"""
- self.strict_build_plan = True
+ self.strict_build_plan = None
"""Whether elements must be rebuilt when their dependencies have changed"""
self.sourcedir = None
@@ -161,15 +161,10 @@ class Context():
_yaml.composite(defaults, user_config)
_yaml.node_validate(defaults, [
- 'strict', 'sourcedir',
- 'builddir', 'artifactdir',
- 'logdir', 'scheduler',
- 'artifacts', 'logging',
- 'projects',
+ 'sourcedir', 'builddir', 'artifactdir', 'logdir',
+ 'scheduler', 'artifacts', 'logging', 'projects',
])
- self.strict_build_plan = _yaml.node_get(defaults, bool, 'strict')
-
for dir in ['sourcedir', 'builddir', 'artifactdir', 'logdir']:
# Allow the ~ tilde expansion and any environment variables in
# path specification in the config files.
@@ -248,6 +243,25 @@ class Context():
def _get_overrides(self, project_name):
return _yaml.node_get(self._project_overrides, Mapping, project_name, default_value={})
+ # _get_strict():
+ #
+ # Fetch whether we are strict or not
+ #
+ # Args:
+ # project_name (str): The project name
+ #
+ # Returns:
+ # (bool): Whether or not to use strict build plan
+ #
+ def _get_strict(self, project_name):
+
+ # If it was set by the CLI, it overrides any config
+ if self.strict_build_plan is not None:
+ return self.strict_build_plan
+
+ overrides = self._get_overrides(project_name)
+ return _yaml.node_get(overrides, bool, 'strict', default_value=True)
+
# _get_cache_key():
#
# Returns the cache key, calculating it if necessary
diff --git a/buildstream/data/userconfig.yaml b/buildstream/data/userconfig.yaml
index 1ab4139fc..8d066ab52 100644
--- a/buildstream/data/userconfig.yaml
+++ b/buildstream/data/userconfig.yaml
@@ -10,9 +10,6 @@
# paths.
#
-# Whether elements must be rebuilt when their dependencies have changed
-strict: True
-
# Location to store sources
sourcedir: ${XDG_CACHE_HOME}/buildstream/sources
@@ -97,19 +94,3 @@ logging:
%{state: >12} %{key} %{name} %{workspace-dirs}
-#
-# Per project overrides
-#
-# Some settings defined in the project configuration can be overridden by
-# the user configuration.
-#
-# projects:
-#
-# project1:
-# artifacts:
-# pull-url: https://artifacts.com
-# push-url: artifacts@artifacts.com:artifacts
-# push-port: 443
-#
-# project2:
-# ...