summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2018-08-17 15:54:43 +0100
committerTom Pollard <tom.pollard@codethink.co.uk>2018-08-30 10:27:18 +0000
commit44a81a5c9fd3257329b4f8ffbd98e3b1fca28144 (patch)
treeadcb3f45526f1ce41c2b9092961dec54c4c5e758
parent26565f11b8dba375e21bf56af0ccf0092a8f8365 (diff)
downloadbuildstream-tpollard/591.tar.gz
buildstream/_project.py: Report if project.conf is missing nametpollard/591
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')