diff mbox series

runqueue.py: clarify that 'closest' signature means 'most recent' (and not closest in its content)

Message ID 20231017133029.146956-1-alex@linutronix.de
State Accepted, archived
Commit 315f48f965a54da5cec92908d91aa61c2d450add
Headers show
Series runqueue.py: clarify that 'closest' signature means 'most recent' (and not closest in its content) | expand

Commit Message

Alexander Kanavin Oct. 17, 2023, 1:30 p.m. UTC
This is printed by 'bitbake -S printdiff' and more accurately reflects what
the code does.

Most of the time the most recent item should be what the user wants to see when debugging sstate
misses, but there could also be printdiff-all (print differences with all
matching sstate objects), or printdiff-N (N most recent, and not just the latest).

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/bb/runqueue.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Oct. 17, 2023, 1:47 p.m. UTC | #1
On Tue, 2023-10-17 at 15:30 +0200, Alexander Kanavin wrote:
> This is printed by 'bitbake -S printdiff' and more accurately reflects what
> the code does.
> 
> Most of the time the most recent item should be what the user wants to see when debugging sstate
> misses, but there could also be printdiff-all (print differences with all
> matching sstate objects), or printdiff-N (N most recent, and not just the latest).
> 
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> ---
>  bitbake/lib/bb/runqueue.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
> index 56147c50a8a..28b9667c47c 100644
> --- a/bitbake/lib/bb/runqueue.py
> +++ b/bitbake/lib/bb/runqueue.py
> @@ -1769,7 +1769,7 @@ class RunQueue:
>                  latestmatch = sorted(matches.keys(), key=lambda f: matches[f])[-1]
>                  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, closest matching task was %s\n  " % (pn, taskname, h, prevh) + '\n  '.join(output))
> +                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))
>  
>  

One of the reasons I don't like this code is that matching "policy"
comes from 'distant' files and runqueue really doesn't know much about
this.

The patch is probably ok but long term we need to handle this better
and in a way which means if we can improve the matching, the message
and code are more spatially related.

Cheers,

Richard
diff mbox series

Patch

diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 56147c50a8a..28b9667c47c 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1769,7 +1769,7 @@  class RunQueue:
                 latestmatch = sorted(matches.keys(), key=lambda f: matches[f])[-1]
                 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, closest matching task was %s\n  " % (pn, taskname, h, prevh) + '\n  '.join(output))
+                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))
 
 
 class RunQueueExecute: