diff options
author | Tiago Gomes <tiago.avv@gmail.com> | 2018-09-14 16:10:28 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.avv@gmail.com> | 2018-09-14 16:10:28 +0000 |
commit | dd513fcc2cc787e64bc15317ed3693a1faefcbec (patch) | |
tree | ba7de66f79b439d82e5b96e1b66dab7627307265 /buildstream/element.py | |
parent | ef846ced8135249a20237c9ec1a2eae5460f8282 (diff) | |
parent | 3cbcec43b929af17fd124ff0b787f02b4b5294af (diff) | |
download | buildstream-dd513fcc2cc787e64bc15317ed3693a1faefcbec.tar.gz |
Merge branch 'tiagogomes/issue-287-backport' into 'bst-1.2'
Backport of !678 (Add validation of configuration variables) to 1.2 branch.
See merge request BuildStream/buildstream!789
Diffstat (limited to 'buildstream/element.py')
-rw-r--r-- | buildstream/element.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index 4f7fc0564..6b0a728e6 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -2166,7 +2166,8 @@ class Element(Plugin): # substituting command strings to be run in the sandbox # def __extract_variables(self, meta): - default_vars = _yaml.node_get(self.__defaults, Mapping, 'variables', default_value={}) + default_vars = _yaml.node_get(self.__defaults, Mapping, 'variables', + default_value={}) project = self._get_project() if self.__is_junction: @@ -2179,6 +2180,13 @@ class Element(Plugin): _yaml.composite(variables, meta.variables) _yaml.node_final_assertions(variables) + for var in ('project-name', 'element-name', 'max-jobs'): + provenance = _yaml.node_get_provenance(variables, var) + if provenance and provenance.filename != '': + raise LoadError(LoadErrorReason.PROTECTED_VARIABLE_REDEFINED, + "{}: invalid redefinition of protected variable '{}'" + .format(provenance, var)) + return variables # This will resolve the final configuration to be handed |