summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2018-08-17 15:54:43 +0100
committerTiago Gomes <tiago.avv@gmail.com>2018-08-30 19:14:33 +0000
commit18d0bfb41d262aad2d76b4b8155ea76e7349b1c5 (patch)
tree2e17512c7b335fb0c3b3c904266e749a5608e74d
parent8cd719eb91acb2c240b459214947a5dd77204106 (diff)
downloadbuildstream-18d0bfb41d262aad2d76b4b8155ea76e7349b1c5.tar.gz
buildstream/_project.py: Report if project.conf is missing name
Explicitly check that project.conf contains a name. This resolves the issue of the provenance check from _yaml.py incorrectly reporting the offending file as the default_config_node projectconfig.yaml when no name key exists in the pre_config_node dict.
-rw-r--r--buildstream/_project.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py
index c489e9025..e94892751 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -398,6 +398,11 @@ class Project():
"Project requested format version {}, but BuildStream {}.{} only supports up until format version {}"
.format(format_version, major, minor, BST_FORMAT_VERSION))
+ # Check if project.conf contains name key field
+ if self._project_conf.get('name') is None:
+ raise LoadError(LoadErrorReason.INVALID_DATA,
+ "{}: project.conf does not contain expected key '{}'".format(projectfile, 'name'))
+
# The project name, element path and option declarations
# are constant and cannot be overridden by option conditional statements
self.name = _yaml.node_get(pre_config_node, str, 'name')