Patchwork RFC bitbake patch: siggen.py: report individual changes to dict

login
register
mail settings
Submitter Mike Crowe
Date Oct. 19, 2012, 4:41 p.m.
Message ID <20121019164136.GA14620@mcrowe.com>
Download mbox | patch
Permalink /patch/38339/
State New
Headers show

Comments

Mike Crowe - Oct. 19, 2012, 4:41 p.m.
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.

Patch

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: