summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildstream/_yaml.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/buildstream/_yaml.py b/src/buildstream/_yaml.py
index cdab4269e..234fc7be1 100644
--- a/src/buildstream/_yaml.py
+++ b/src/buildstream/_yaml.py
@@ -31,6 +31,8 @@ from itertools import count
from ruamel import yaml
from ._exceptions import LoadError, LoadErrorReason
+import ujson
+import hashlib
# Without this, pylint complains about all the `type(foo) is blah` checks
# because it feels isinstance() is more idiomatic. Sadly, it is much slower to
@@ -68,6 +70,10 @@ class Node(namedtuple('Node', ['value', 'file_index', 'line', 'column'])):
# code which has access to such nodes would do this.
return what in self[0]
+ def _identity(self):
+ ordered = node_sanitize(self)
+ ustring = ujson.dumps(ordered, sort_keys=True, escape_forward_slashes=False).encode('utf-8')
+ return hashlib.sha256(ustring).hexdigest()
# File name handling
_FILE_LIST = []
@@ -945,6 +951,9 @@ def composite(target, source):
assert type(source[0]) is dict
assert type(target[0]) is dict
+ with open("/tmp/composition.log", "a") as fh:
+ fh.write("{} <- {}\n".format(target._identity(), source._identity()))
+
try:
composite_dict(target, source)
except CompositeError as e: