summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Jörns <ejo@pengutronix.de>2025-03-03 17:35:22 +0100
committerSteve Sakoman <steve@sakoman.com>2025-03-08 06:22:56 -0800
commited5b12569837041d19a269b32b1437f3fd254a04 (patch)
tree2ec7fc3ced65dc8212916e0021289511d8f94598
parent7a06e2daa719ca0cac9905988f72bb0cb546c7b5 (diff)
downloadpoky-ed5b12569837041d19a269b32b1437f3fd254a04.tar.gz
bitbake: bitbake-diffsigs: fix handling when finding only a single sigfile
This fixes the following error when calling 'bitbake-dumpsig' or 'bitbake-diffsigs' when having only a single sigfile available: | Traceback (most recent call last): | File "[..]/poky/bitbake/bin/bitbake-dumpsig", line 171, in <module> | files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "[..]/poky/bitbake/bin/bitbake-dumpsig", line 83, in find_siginfo_task | sig2 = latestsigs[1] | ~~~~~~~~~~^^^ | IndexError: list index out of range Handle this by adding (and returning) the path for the second sigfile only if one is found. This way it will work for both diffsigs and dumpsig use case. The calling argparse code already deals with find_siginfo_task() returning only a single file. For 'bitbake-dumpsig' it will just dump the single sigfile, for 'bitbake-diffsigs' it will emit a proper error message again: | ERROR: Only one matching sigdata file found for the specified task (systemd configure) (cherry picked from commit 25057d33e9131f3214a06bbb316c916c744f8f03) (Bitbake rev: 4e443aeab9096b41c9e5ba41cd21027ecaa20285) Signed-off-by: Enrico Jörns <ejo@pengutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Patrick Vogelaar <patrick.vogelaar@belden.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rwxr-xr-xbitbake/bin/bitbake-diffsigs9
1 files changed, 5 insertions, 4 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index 8202c78623..9d6cb8c944 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -72,16 +72,17 @@ def find_siginfo_task(bbhandler, pn, taskname, sig1=None, sig2=None):
72 elif sig2 not in sigfiles: 72 elif sig2 not in sigfiles:
73 logger.error('No sigdata files found matching %s %s with signature %s' % (pn, taskname, sig2)) 73 logger.error('No sigdata files found matching %s %s with signature %s' % (pn, taskname, sig2))
74 sys.exit(1) 74 sys.exit(1)
75
76 latestfiles = [sigfiles[sig1]['path'], sigfiles[sig2]['path']]
75 else: 77 else:
76 sigfiles = find_siginfo(bbhandler, pn, taskname) 78 sigfiles = find_siginfo(bbhandler, pn, taskname)
77 latestsigs = sorted(sigfiles.keys(), key=lambda h: sigfiles[h]['time'])[-2:] 79 latestsigs = sorted(sigfiles.keys(), key=lambda h: sigfiles[h]['time'])[-2:]
78 if not latestsigs: 80 if not latestsigs:
79 logger.error('No sigdata files found matching %s %s' % (pn, taskname)) 81 logger.error('No sigdata files found matching %s %s' % (pn, taskname))
80 sys.exit(1) 82 sys.exit(1)
81 sig1 = latestsigs[0] 83 latestfiles = [sigfiles[latestsigs[0]]['path']]
82 sig2 = latestsigs[1] 84 if len(latestsigs) > 1:
83 85 latestfiles.append(sigfiles[latestsigs[1]]['path'])
84 latestfiles = [sigfiles[sig1]['path'], sigfiles[sig2]['path']]
85 86
86 return latestfiles 87 return latestfiles
87 88