summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2023-12-18 09:44:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-05 11:59:08 +0000
commitcc85c8eb9d96e91a7767e92c86f0d7f2960b093b (patch)
tree17164f1069922decfbc39ea7610b0da45763f91a
parenta41b54ccbd90a55ee15f0952ec10df6db5b64db4 (diff)
downloadpoky-cc85c8eb9d96e91a7767e92c86f0d7f2960b093b.tar.gz
bitbake: bitbake-diffsigs/runqueue: adapt to reworked find_siginfo()
In particular having 'time' explicitly used as a sorting key should make it more clear how the entries are being sorted. (Bitbake rev: 5439aca056c84ab4410aaf24bdb68e896191d8e1) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/bin/bitbake-diffsigs11
-rw-r--r--bitbake/lib/bb/runqueue.py10
2 files changed, 12 insertions, 9 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index fe0f33eea1..a8f49191b0 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -72,13 +72,16 @@ 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 latestfiles = [sigfiles[sig1], sigfiles[sig2]]
76 else: 75 else:
77 filedates = find_siginfo(bbhandler, pn, taskname) 76 sigfiles = find_siginfo(bbhandler, pn, taskname)
78 latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:] 77 latestsigs = sorted(sigfiles.keys(), key=lambda h: sigfiles[h]['time'])[-2:]
79 if not latestfiles: 78 if not latestsigs:
80 logger.error('No sigdata files found matching %s %s' % (pn, taskname)) 79 logger.error('No sigdata files found matching %s %s' % (pn, taskname))
81 sys.exit(1) 80 sys.exit(1)
81 sig1 = latestsigs[0]
82 sig2 = latestsigs[1]
83
84 latestfiles = [sigfiles[sig1]['path'], sigfiles[sig2]['path']]
82 85
83 return latestfiles 86 return latestfiles
84 87
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index e14b5d41e1..d61dfbb691 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1759,7 +1759,7 @@ class RunQueue:
1759 1759
1760 recout = [] 1760 recout = []
1761 if len(hashfiles) == 2: 1761 if len(hashfiles) == 2:
1762 out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb) 1762 out2 = bb.siggen.compare_sigfiles(hashfiles[hash1]['path'], hashfiles[hash2]['path'], recursecb)
1763 recout.extend(list(' ' + l for l in out2)) 1763 recout.extend(list(' ' + l for l in out2))
1764 else: 1764 else:
1765 recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2)) 1765 recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2))
@@ -1775,14 +1775,14 @@ class RunQueue:
1775 matches = bb.siggen.find_siginfo(pn, taskname, [], self.cooker.databuilder.mcdata[mc]) 1775 matches = bb.siggen.find_siginfo(pn, taskname, [], self.cooker.databuilder.mcdata[mc])
1776 bb.debug(1, "Found hashfiles:\n{}".format(matches)) 1776 bb.debug(1, "Found hashfiles:\n{}".format(matches))
1777 match = None 1777 match = None
1778 for m in matches: 1778 for m in matches.values():
1779 if h in m: 1779 if h in m['path']:
1780 match = m 1780 match = m['path']
1781 if match is None: 1781 if match is None:
1782 bb.fatal("Can't find a task we're supposed to have written out? (hash: %s tid: %s)?" % (h, tid)) 1782 bb.fatal("Can't find a task we're supposed to have written out? (hash: %s tid: %s)?" % (h, tid))
1783 matches = {k : v for k, v in iter(matches.items()) if h not in k} 1783 matches = {k : v for k, v in iter(matches.items()) if h not in k}
1784 if matches: 1784 if matches:
1785 latestmatch = sorted(matches.keys(), key=lambda f: matches[f])[-1] 1785 latestmatch = matches[sorted(matches.keys(), key=lambda h: matches[h]['time'])[-1]]['path']
1786 prevh = __find_sha256__.search(latestmatch).group(0) 1786 prevh = __find_sha256__.search(latestmatch).group(0)
1787 output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb) 1787 output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb)
1788 bb.plain("\nTask %s:%s couldn't be used from the cache because:\n We need hash %s, most recent matching task was %s\n " % (pn, taskname, h, prevh) + '\n '.join(output)) 1788 bb.plain("\nTask %s:%s couldn't be used from the cache because:\n We need hash %s, most recent matching task was %s\n " % (pn, taskname, h, prevh) + '\n '.join(output))