| Message ID | 20251103-fix-dumpsig-v2-1-2b5eaf94df49@pbarker.dev |
|---|---|
| State | New |
| Headers | show |
| Series | [v2] siggen: Fix dump of non-runtime sigdata | expand |
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py index 41eb6430122f..985fa7e4ca1d 100644 --- a/lib/bb/siggen.py +++ b/lib/bb/siggen.py @@ -1263,7 +1263,10 @@ def dump_sigfile(a): else: output.append("Unable to compute base hash") - computed_taskhash = calc_taskhash(a_data) - output.append("Computed task hash is %s" % computed_taskhash) + if 'runtaskdeps' in a_data: + computed_taskhash = calc_taskhash(a_data) + output.append("Computed task hash is %s" % computed_taskhash) + else: + output.append("Unable to compute task hash") return output
If the debug code is uncommented in SignatureGeneratorBasic.finalise(), sigtask stamp file are created without runtime data such as 'runtaskdeps' and 'file_checksum_values'. If we then try to run bitbake-dumpsig on one of these files, we will see a traceback as the expected keys are not present in the sigdata dictionary: Traceback (most recent call last): File ".../bitbake/bin/bitbake-dumpsig", line 195, in <module> output = bb.siggen.dump_sigfile(options.sigdatafile1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".../bitbake/lib/bb/siggen.py", line 1266, in dump_sigfile computed_taskhash = calc_taskhash(a_data) ^^^^^^^^^^^^^^^^^^^^^ File ".../bitbake/lib/bb/siggen.py", line 1199, in calc_taskhash for dep in sigdata['runtaskdeps']: ~~~~~~~^^^^^^^^^^^^^^^ KeyError: 'runtaskdeps' To fix this, do not try to compute a task hash if the required data is not present. We can key off 'runtaskdeps' as this will likely always be needed to calculate a valid task hash. Signed-off-by: Paul Barker <paul@pbarker.dev> --- Changes in v2: - Skip tash hash calculation if 'runtaskdeps' is missing. - Link to v1: https://lore.kernel.org/r/20251027-fix-dumpsig-v1-1-465674c4fac3@pbarker.dev --- lib/bb/siggen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- base-commit: acf5b02c5aaae1116d33b4e08b2ad7c27d9b94ab change-id: 20251027-fix-dumpsig-e945637ad89f Best regards,