summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildstream/_loader/loadelement.pyx4
-rw-r--r--src/buildstream/_loader/loader.py10
2 files changed, 10 insertions, 4 deletions
diff --git a/src/buildstream/_loader/loadelement.pyx b/src/buildstream/_loader/loadelement.pyx
index 784ab8f7b..de2f96b37 100644
--- a/src/buildstream/_loader/loadelement.pyx
+++ b/src/buildstream/_loader/loadelement.pyx
@@ -52,11 +52,13 @@ cdef class Dependency:
cdef readonly LoadElement element
cdef readonly str dep_type
cdef readonly bint strict
+ cdef readonly ProvenanceInformation provenance
- def __cinit__(self, LoadElement element, str dep_type, bint strict):
+ def __cinit__(self, LoadElement element, str dep_type, bint strict, ProvenanceInformation provenance):
self.element = element
self.dep_type = dep_type
self.strict = strict
+ self.provenance = provenance
# LoadElement():
diff --git a/src/buildstream/_loader/loader.py b/src/buildstream/_loader/loader.py
index 13d8f9f21..e63dd6c57 100644
--- a/src/buildstream/_loader/loader.py
+++ b/src/buildstream/_loader/loader.py
@@ -120,7 +120,7 @@ class Loader:
dummy_target = LoadElement(Node.from_dict({}), "", self)
# Pylint is not very happy with Cython and can't understand 'dependencies' is a list
dummy_target.dependencies.extend( # pylint: disable=no-member
- Dependency(element, Symbol.RUNTIME, False) for element in target_elements
+ Dependency(element, Symbol.RUNTIME, False, None) for element in target_elements
)
with PROFILER.profile(Topics.CIRCULAR_CHECK, "_".join(targets)):
@@ -403,7 +403,7 @@ class Loader:
# All is well, push the dependency onto the LoadElement
# Pylint is not very happy with Cython and can't understand 'dependencies' is a list
current_element[0].dependencies.append( # pylint: disable=no-member
- Dependency(dep_element, dep.dep_type, dep.strict)
+ Dependency(dep_element, dep.dep_type, dep.strict, dep.provenance)
)
else:
# We do not have any more dependencies to load for this
@@ -613,7 +613,11 @@ class Loader:
# would be nice if this could be done for *all* element types,
# but since we haven't loaded those yet that's impossible.
if load_element.dependencies:
- raise LoadError("Dependencies are forbidden for 'junction' elements", LoadErrorReason.INVALID_JUNCTION)
+ # Use the first dependency in the list as provenance
+ p = load_element.dependencies[0].provenance
+ raise LoadError(
+ "{}: Dependencies are forbidden for 'junction' elements".format(p), LoadErrorReason.INVALID_JUNCTION
+ )
element = Element._new_from_meta(meta_element)
element._initialize_state()