diff options
Diffstat (limited to 'bitbake/lib/bb/siggen.py')
-rw-r--r-- | bitbake/lib/bb/siggen.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index f526792efd..578ba5d661 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -24,9 +24,14 @@ hashequiv_logger = logging.getLogger('BitBake.SigGen.HashEquiv') | |||
24 | class SetEncoder(json.JSONEncoder): | 24 | class SetEncoder(json.JSONEncoder): |
25 | def default(self, obj): | 25 | def default(self, obj): |
26 | if isinstance(obj, set): | 26 | if isinstance(obj, set): |
27 | return list(sorted(obj)) | 27 | return dict(_set_object=list(sorted(obj))) |
28 | return json.JSONEncoder.default(self, obj) | 28 | return json.JSONEncoder.default(self, obj) |
29 | 29 | ||
30 | def SetDecoder(dct): | ||
31 | if '_set_object' in dct: | ||
32 | return set(dct['_set_object']) | ||
33 | return dct | ||
34 | |||
30 | def init(d): | 35 | def init(d): |
31 | siggens = [obj for obj in globals().values() | 36 | siggens = [obj for obj in globals().values() |
32 | if type(obj) is type and issubclass(obj, SignatureGenerator)] | 37 | if type(obj) is type and issubclass(obj, SignatureGenerator)] |
@@ -803,9 +808,9 @@ def compare_sigfiles(a, b, recursecb=None, color=False, collapsed=False): | |||
803 | return formatstr.format(**formatparams) | 808 | return formatstr.format(**formatparams) |
804 | 809 | ||
805 | with bb.compress.zstd.open(a, "rt", encoding="utf-8", num_threads=1) as f: | 810 | with bb.compress.zstd.open(a, "rt", encoding="utf-8", num_threads=1) as f: |
806 | a_data = json.load(f) | 811 | a_data = json.load(f, object_hook=SetDecoder) |
807 | with bb.compress.zstd.open(b, "rt", encoding="utf-8", num_threads=1) as f: | 812 | with bb.compress.zstd.open(b, "rt", encoding="utf-8", num_threads=1) as f: |
808 | b_data = json.load(f) | 813 | b_data = json.load(f, object_hook=SetDecoder) |
809 | 814 | ||
810 | def dict_diff(a, b, whitelist=set()): | 815 | def dict_diff(a, b, whitelist=set()): |
811 | sa = set(a.keys()) | 816 | sa = set(a.keys()) |
@@ -821,11 +826,11 @@ def compare_sigfiles(a, b, recursecb=None, color=False, collapsed=False): | |||
821 | 826 | ||
822 | def file_checksums_diff(a, b): | 827 | def file_checksums_diff(a, b): |
823 | from collections import Counter | 828 | from collections import Counter |
824 | # Handle old siginfo format | 829 | |
825 | if isinstance(a, dict): | 830 | # Convert lists back to tuples |
826 | a = [(os.path.basename(f), cs) for f, cs in a.items()] | 831 | a = [(f[0], f[1]) for f in a] |
827 | if isinstance(b, dict): | 832 | b = [(f[0], f[1]) for f in b] |
828 | b = [(os.path.basename(f), cs) for f, cs in b.items()] | 833 | |
829 | # Compare lists, ensuring we can handle duplicate filenames if they exist | 834 | # Compare lists, ensuring we can handle duplicate filenames if they exist |
830 | removedcount = Counter(a) | 835 | removedcount = Counter(a) |
831 | removedcount.subtract(b) | 836 | removedcount.subtract(b) |
@@ -908,9 +913,9 @@ def compare_sigfiles(a, b, recursecb=None, color=False, collapsed=False): | |||
908 | output.append(color_format("{color_title}Variable {var} value changed from '{color_default}{oldval}{color_title}' to '{color_default}{newval}{color_title}'{color_default}", var=dep, oldval=oldval, newval=newval)) | 913 | output.append(color_format("{color_title}Variable {var} value changed from '{color_default}{oldval}{color_title}' to '{color_default}{newval}{color_title}'{color_default}", var=dep, oldval=oldval, newval=newval)) |
909 | 914 | ||
910 | if not 'file_checksum_values' in a_data: | 915 | if not 'file_checksum_values' in a_data: |
911 | a_data['file_checksum_values'] = {} | 916 | a_data['file_checksum_values'] = [] |
912 | if not 'file_checksum_values' in b_data: | 917 | if not 'file_checksum_values' in b_data: |
913 | b_data['file_checksum_values'] = {} | 918 | b_data['file_checksum_values'] = [] |
914 | 919 | ||
915 | changed, added, removed = file_checksums_diff(a_data['file_checksum_values'], b_data['file_checksum_values']) | 920 | changed, added, removed = file_checksums_diff(a_data['file_checksum_values'], b_data['file_checksum_values']) |
916 | if changed: | 921 | if changed: |
@@ -1038,7 +1043,7 @@ def dump_sigfile(a): | |||
1038 | output = [] | 1043 | output = [] |
1039 | 1044 | ||
1040 | with bb.compress.zstd.open(a, "rt", encoding="utf-8", num_threads=1) as f: | 1045 | with bb.compress.zstd.open(a, "rt", encoding="utf-8", num_threads=1) as f: |
1041 | a_data = json.load(f) | 1046 | a_data = json.load(f, object_hook=SetDecoder) |
1042 | 1047 | ||
1043 | output.append("basewhitelist: %s" % (a_data['basewhitelist'])) | 1048 | output.append("basewhitelist: %s" % (a_data['basewhitelist'])) |
1044 | 1049 | ||