Openembedded Core Discussions
 help / color / mirror / Atom feed
* RFC bitbake patch: siggen.py: report individual changes to dict
@ 2012-10-19 16:41 Mike Crowe
  0 siblings, 0 replies; only message in thread
From: Mike Crowe @ 2012-10-19 16:41 UTC (permalink / raw)
  To: openembedded-core

I found it quite difficult to find the actual change among the copious
output of bitbake-diffsigs when the environment differs so I came up
with this to simplify the reporting.

-----8<----

    siggen.py: If changed variable is a dict then report the individual values
    that have changed
    
    If the signature has changed due to a variable changing and that variable
    is a dict then try and report the individual values that have changed.

diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 862c73b..c72b164 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -363,7 +363,16 @@ def compare_sigfiles(a, b, recursecb = None):
     changed, added, removed = dict_diff(a_data['varvals'], b_data['varvals'])
     if changed:
         for dep in changed:
-            output.append("Variable %s value changed from %s to %s" % (dep, a_data['varvals'][dep], b_data['varvals'][dep]))
+            if isinstance(a_data['varvals'][dep], dict) and isinstance(b_data['varvals'][dep], dict):
+                subchanged, subadded, subremoved = dict_diff(a_data['varvals'][dep], b_data['varvals'][dep])
+                for k in subchanged:
+                    output.append("Variable %s value ['%s'] changed from '%s' to '%s'. " % (dep, k, a_data['varvals'][dep][k], b_data['varvals'][dep][k]))
+                for k in subadded:
+                    output.append("Variable %s value ['%s'] changed from not present to '%s'. " % (dep, k, b_data['varvals'][dep][k]))
+                for k in subremoved:
+                    output.append("Variable %s value ['%s'] changed from '%s' to not present. " % (dep, k, a_data['varvals'][dep][k]))
+            else:
+                output.append("Variable %s value changed from %s to %s" % (dep, a_data['varvals'][dep], b_data['varvals'][dep]))
 
     changed, added, removed = dict_diff(a_data['file_checksum_values'], b_data['file_checksum_values'])
     if changed:



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-19 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-19 16:41 RFC bitbake patch: siggen.py: report individual changes to dict Mike Crowe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox