summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildstream/_loader/loader.py8
-rw-r--r--buildstream/_loader/metasource.py4
2 files changed, 7 insertions, 5 deletions
diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py
index a79e80bb3..8e6c76425 100644
--- a/buildstream/_loader/loader.py
+++ b/buildstream/_loader/loader.py
@@ -372,6 +372,7 @@ class Loader():
meta_sources = []
sources = _yaml.node_get(node, list, Symbol.SOURCES, default_value=[])
+ element_kind = _yaml.node_get(node, str, Symbol.KIND)
# Safe loop calling into _yaml.node_get() for each element ensures
# we have good error reporting
@@ -386,11 +387,10 @@ class Loader():
del source[Symbol.DIRECTORY]
index = sources.index(source)
- meta_source = MetaSource(element_name, index, kind, source, directory)
+ meta_source = MetaSource(element_name, index, element_kind, kind, source, directory)
meta_sources.append(meta_source)
- kind = _yaml.node_get(node, str, Symbol.KIND)
- meta_element = MetaElement(self.project, element_name, kind,
+ meta_element = MetaElement(self.project, element_name, element_kind,
elt_provenance, meta_sources,
_yaml.node_get(node, Mapping, Symbol.CONFIG, default_value={}),
_yaml.node_get(node, Mapping, Symbol.VARIABLES, default_value={}),
@@ -404,7 +404,7 @@ class Loader():
# Descend
for dep in element.deps:
- if kind == 'junction':
+ if element_kind == 'junction':
raise LoadError(LoadErrorReason.INVALID_DATA,
"{}: Junctions do not support dependencies".format(dep.provenance))
diff --git a/buildstream/_loader/metasource.py b/buildstream/_loader/metasource.py
index 5f3fa3608..75e191595 100644
--- a/buildstream/_loader/metasource.py
+++ b/buildstream/_loader/metasource.py
@@ -28,12 +28,14 @@ class MetaSource():
# Args:
# element_name: The name of the owning element
# element_index: The index of the source in the owning element's source list
+ # element_kind: The kind of the owning element
# kind: The kind of the source
# config: The configuration data for the source
#
- def __init__(self, element_name, element_index, kind, config, directory):
+ def __init__(self, element_name, element_index, element_kind, kind, config, directory):
self.element_name = element_name
self.element_index = element_index
+ self.element_kind = element_kind
self.kind = kind
self.config = config
self.directory = directory