summaryrefslogtreecommitdiff
path: root/buildstream/source.py
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-05-02 15:19:06 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-05-02 15:23:19 +0100
commit6961eec10ab6d375978713ccde83dc12e6ef86db (patch)
tree431745b808af08a3d2d9034da6f2df5acad92e3d /buildstream/source.py
parentbccb4f15a784a80561c32665ced44554dbd9b5ce (diff)
downloadbuildstream-6961eec10ab6d375978713ccde83dc12e6ef86db.tar.gz
_yaml.py, source.py: Fix tracking of refs inside conditions
Previously if you had a source of the form: ```yaml - (?): somecondition: url: blah ref: foo othercondition: url: blah ref: bar ``` And you did `bst source track` on the element then you'd get something output of the form: ```yaml - (?)... ... ref: wibble ``` With this patch, the *correct* ref inside the conditionals is updated instead. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Diffstat (limited to 'buildstream/source.py')
-rw-r--r--buildstream/source.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/source.py b/buildstream/source.py
index daf2cb27c..0c07dd41e 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -951,10 +951,15 @@ class Source(Plugin):
provenance = _yaml.node_get_provenance(node)
else:
provenance = _yaml.node_get_provenance(node, key=key)
+
toplevel_node = provenance.toplevel
# Get the path to whatever changed
- path = _yaml.node_find_target(toplevel_node, node)
+ if action == 'add':
+ path = _yaml.node_find_target(toplevel_node, node)
+ else:
+ path = _yaml.node_find_target(toplevel_node, node, key=key)
+
roundtrip_file = roundtrip_cache.get(provenance.filename)
if not roundtrip_file:
roundtrip_file = roundtrip_cache[provenance.filename] = _yaml.roundtrip_load(