($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: yang.xu@mediatek.com, bitbake-devel@lists.openembedded.org
Subject: Re: [bitbake-devel] [PATCH] checksum: fix unstable sort of checksums
Date: Tue, 14 May 2024 11:29:22 +0100	[thread overview]
Message-ID: <b04b6879b8613c793e5e4d8d90b98d694665fdb8.camel@linuxfoundation.org> (raw)
In-Reply-To: <20240514101257.31020-1-yang.xu@mediatek.com>

On Tue, 2024-05-14 at 10:12 +0000, Yang Xu via lists.openembedded.org wrote:
> From: Yang Xu <yang.xu@mediatek.com>
> 
> Using only the checksum as sorting key can lead to unstable results when
> same content files exist in different subfolders, affecting the taskhash
> calculation due to its sensitivity to the order of files in checksums.
> 
> This commit changes the sorting key to use both checksum and file path,
> ensuring stable sorting and enhancing sstate cache hit rates.
> 
> Signed-off-by: Yang Xu <yang.xu@mediatek.com>
> ---
>  lib/bb/checksum.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/bb/checksum.py b/lib/bb/checksum.py
> index 557793d3..5294ddf1 100644
> --- a/lib/bb/checksum.py
> +++ b/lib/bb/checksum.py
> @@ -140,5 +140,5 @@ class FileChecksumCache(MultiProcessCache):
>                  if checksum:
>                      checksums.append((pth, checksum))
>  
> -        checksums.sort(key=operator.itemgetter(1))
> +        checksums.sort(key=lambda x:(x[1], x[0]))
>          return checksums
> 

Which version of the project are you testing this with?

The checksum data is sorted where it is used in siggen.py so sorting
here shouldn't make much difference?

Cheers,

Richard


  reply	other threads:[~2024-05-14 10:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 10:12 [PATCH] checksum: fix unstable sort of checksums yang.xu
2024-05-14 10:29 ` Richard Purdie [this message]
2024-05-14 11:20   ` Yang Xu

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=b04b6879b8613c793e5e4d8d90b98d694665fdb8.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=yang.xu@mediatek.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).