Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH 7/9] bitbake-diffsigs/runqueue: adapt to reworked find_siginfo()
Date: Thu, 14 Dec 2023 14:45:26 +0100	[thread overview]
Message-ID: <20231214134528.1973602-7-alex@linutronix.de> (raw)
In-Reply-To: <20231214134528.1973602-1-alex@linutronix.de>

In particular having 'time' explicitly used as a sorting key should make it
more clear how the entries are being sorted.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/bin/bitbake-diffsigs | 11 +++++++----
 bitbake/lib/bb/runqueue.py   | 10 +++++-----
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index fe0f33eea17..a8f49191b0c 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):
         elif sig2 not in sigfiles:
             logger.error('No sigdata files found matching %s %s with signature %s' % (pn, taskname, sig2))
             sys.exit(1)
-        latestfiles = [sigfiles[sig1], sigfiles[sig2]]
     else:
-        filedates = find_siginfo(bbhandler, pn, taskname)
-        latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:]
-        if not latestfiles:
+        sigfiles = find_siginfo(bbhandler, pn, taskname)
+        latestsigs = sorted(sigfiles.keys(), key=lambda h: sigfiles[h]['time'])[-2:]
+        if not latestsigs:
             logger.error('No sigdata files found matching %s %s' % (pn, taskname))
             sys.exit(1)
+        sig1 = latestsigs[0]
+        sig2 = latestsigs[1]
+
+    latestfiles = [sigfiles[sig1]['path'], sigfiles[sig2]['path']]
 
     return latestfiles
 
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 61effe24fae..ac5222514de 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1755,7 +1755,7 @@ class RunQueue:
 
             recout = []
             if len(hashfiles) == 2:
-                out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
+                out2 = bb.siggen.compare_sigfiles(hashfiles[hash1]['path'], hashfiles[hash2]['path'], recursecb)
                 recout.extend(list('    ' + l for l in out2))
             else:
                 recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2))
@@ -1769,14 +1769,14 @@ class RunQueue:
             h = self.rqdata.runtaskentries[tid].unihash
             matches = bb.siggen.find_siginfo(pn, taskname, [], self.cooker.databuilder.mcdata[mc])
             match = None
-            for m in matches:
-                if h in m:
-                    match = m
+            for m in matches.values():
+                if h in m['path']:
+                    match = m['path']
             if match is None:
                 bb.fatal("Can't find a task we're supposed to have written out? (hash: %s tid: %s)?" % (h, tid))
             matches = {k : v for k, v in iter(matches.items()) if h not in k}
             if matches:
-                latestmatch = sorted(matches.keys(), key=lambda f: matches[f])[-1]
+                latestmatch = matches[sorted(matches.keys(), key=lambda h: matches[h]['time'])[-1]]['path']
                 prevh = __find_sha256__.search(latestmatch).group(0)
                 output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb)
                 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))
-- 
2.39.2



  parent reply	other threads:[~2023-12-14 13:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 13:45 [PATCH 1/9] oeqa/selftest/sstatetests: re-work CDN tests, add local cache tests Alexander Kanavin
2023-12-14 13:45 ` [PATCH 2/9] gnu-config: delete do_compile task Alexander Kanavin
2023-12-14 13:45 ` [PATCH 3/9] bitbake/runqueue: initialize RunQueueExecute before printdiff rather than after Alexander Kanavin
2023-12-14 14:39   ` [OE-core] " Richard Purdie
2023-12-14 17:28     ` Alexander Kanavin
2023-12-15 16:04       ` Richard Purdie
2023-12-15 16:49         ` Alexander Kanavin
2023-12-15 16:56           ` Richard Purdie
2023-12-14 13:45 ` [PATCH 4/9] bitbake/runqueue: rework 'bitbake -S printdiff' logic Alexander Kanavin
2023-12-14 13:45 ` [PATCH 5/9] selftest/sstatetests: fix up printdiff test to match rework of printdiff logic Alexander Kanavin
2023-12-14 13:45 ` [PATCH 6/9] sstatesig/find_siginfo: unify a disjointed API Alexander Kanavin
2023-12-14 13:45 ` Alexander Kanavin [this message]
2023-12-14 13:45 ` [PATCH 8/9] bitbake/runqueue: prioritize local stamps over sstate signatures in printdiff Alexander Kanavin
2023-12-14 13:45 ` [PATCH 9/9] bitbake/runqueue: add debugging for find_siginfo() calls Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231214134528.1973602-7-alex@linutronix.de \
    --to=alex.kanavin@gmail.com \
    --cc=alex@linutronix.de \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox