summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-03-09 19:55:59 +0900
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-12 07:14:58 +0000
commite317bd1d5db00ce71186048302c15aee58875d95 (patch)
treed11523fbdb787926ef2ebada8b3d9a920f11348b
parent805b4564fca644a360074da6392b045cc6b27a40 (diff)
downloadbuildstream-e317bd1d5db00ce71186048302c15aee58875d95.tar.gz
_yaml.py: Report more accurate provenance information
When printing the provenance, show the fully qualified element name including the junction prefix in the case that the provenance comes from a subproject. This makes much more sensible error reporting when reporting errors which originate from a subproject.
-rw-r--r--buildstream/_yaml.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py
index fc24a223b..5dde9237e 100644
--- a/buildstream/_yaml.py
+++ b/buildstream/_yaml.py
@@ -69,7 +69,11 @@ class Provenance():
# Convert a Provenance to a string for error reporting
def __str__(self):
- return "{} [line {:d} column {:d}]".format(self.filename.shortname, self.line, self.col)
+ filename = self.filename.shortname
+ if self.filename.project and self.filename.project.junction:
+ filename = "{}:{}".format(self.filename.project.junction.name, self.filename.shortname)
+
+ return "{} [line {:d} column {:d}]".format(filename, self.line, self.col)
# Abstract method
def clone(self):