summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2017-09-07 11:04:09 +0100
committerTristan Maat <tristan.maat@codethink.co.uk>2017-09-14 10:51:50 +0100
commit6691d0eb7e20c5872d7a5f439f308ae46019777f (patch)
treea4bbb51d273c72b144ce79f59ad7653e9dffc3b9
parentf0cf37a3fb3a7c9c5a405c63df09363a33f49577 (diff)
downloadbuildstream-6691d0eb7e20c5872d7a5f439f308ae46019777f.tar.gz
project.py: Add project config node validations
-rw-r--r--buildstream/project.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/buildstream/project.py b/buildstream/project.py
index fb91d30ef..7a9f43d3d 100644
--- a/buildstream/project.py
+++ b/buildstream/project.py
@@ -158,6 +158,13 @@ class Project():
# Load project local config and override the builtin
project_conf = _yaml.load(projectfile)
_yaml.composite(config, project_conf, typesafe=True)
+ _yaml.validate_node(config, [
+ 'required-versions',
+ 'element-path', 'variables',
+ 'environment', 'environment-nocache',
+ 'split-rules', 'elements', 'plugins',
+ 'aliases', 'name'
+ ])
# Resolve arches keyword, project may have arch conditionals
_loader.resolve_arch(config, self._host_arch, self._target_arch)
@@ -233,6 +240,7 @@ class Project():
# Version requirements
versions = _yaml.node_get(self._unresolved_config, Mapping, 'required-versions')
+ _yaml.validate_node(versions, ['project', 'elements', 'sources'])
# Assert project version first
format_version = _yaml.node_get(versions, int, 'project')
@@ -259,6 +267,7 @@ class Project():
# Load the plugin paths
plugins = _yaml.node_get(self._unresolved_config, Mapping, 'plugins', default_value={})
+ _yaml.validate_node(plugins, ['elements', 'sources'])
self._plugin_source_paths = [os.path.join(self.directory, path)
for path in self._extract_plugin_paths(plugins, 'sources')]
self._plugin_element_paths = [os.path.join(self.directory, path)