diff mbox series

image_types_wic: Fix file-checksums for missing files in search path

Message ID 20250623142626.2914459-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit ef96e2efcd95785e29ff7c62b2cb76e26f46f5ec
Headers show
Series image_types_wic: Fix file-checksums for missing files in search path | expand

Commit Message

Richard Purdie June 23, 2025, 2:26 p.m. UTC
When we tell bitbake about file-checksums, we need to tell it both the files
we look at that exist, but also the ones we looked for but aren't present.

This means that if files appear earlier in the search path, bitbake can then
do the correct things like updating the taskhash and re-running the recipe/task.

In this case, wic was only signalling file presence. This patch adds in the
files it looked at but didn't find too.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes-recipe/image_types_wic.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Frederic Hoerni June 24, 2025, 9:24 a.m. UTC | #1
On 23/06/2025 16:26, Richard Purdie via lists.openembedded.org wrote:
> When we tell bitbake about file-checksums, we need to tell it both the files
> we look at that exist, but also the ones we looked for but aren't present.
>
> This means that if files appear earlier in the search path, bitbake can then
> do the correct things like updating the taskhash and re-running the recipe/task.
>
> In this case, wic was only signalling file presence. This patch adds in the
> files it looked at but didn't find too.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>   meta/classes-recipe/image_types_wic.bbclass | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass
> index 740ed946f8f..6180874a4cc 100644
> --- a/meta/classes-recipe/image_types_wic.bbclass
> +++ b/meta/classes-recipe/image_types_wic.bbclass
> @@ -57,6 +57,16 @@ def wks_search(files, search_path):
>               if searched:
>                   return searched
>
> +def wks_checksums(files, search_path):
> +    ret = ""
> +    for f in files:
> +        found, hist = bb.utils.which(search_path, f, history=True)
> +        ret = ret + " " + " ".join(h + ":False" for h in hist[:-1])
> +        if found:
> +            ret = ret + " " + found + ":True"
> +    return ret
> +
> +
>   WIC_CREATE_EXTRA_ARGS ?= ""
>
>   IMAGE_CMD:wic () {
> @@ -98,7 +108,7 @@ do_image_wic[cleandirs] = "${WORKDIR}/build-wic"
>
>   # Rebuild when the wks file or vars in WICVARS change
>   USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
> -WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}"
> +WKS_FILE_CHECKSUM = "${@wks_checksums(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH')) if '${USING_WIC}' else ''}"
>   do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
>   do_image_wic[depends] += "${@' '.join('%s-native:do_populate_sysroot' % r for r in ('parted', 'gptfdisk', 'dosfstools', 'mtools'))}"
>

This patch fixes my issue.
Thank you.

Frederic

Witekio France is an SAS company registered in Lyon. Registered office: 14 rue Rhin et Danube - 69009 Lyon. Registered company number: RCS 518 864 012 00035. VAT number FR 68 518 864 012
This message contains confidential information and is intended only for the individual(s) addressed in the message. If you aren't the named addressee, you should not disseminate, distribute, or copy this e-mail.

We continuously commit to comply with the applicable data protection laws and ensure fair and transparent processing of your personal data. Please read our privacy statement including an information notice and data protection policy for detailed information on our website.
diff mbox series

Patch

diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass
index 740ed946f8f..6180874a4cc 100644
--- a/meta/classes-recipe/image_types_wic.bbclass
+++ b/meta/classes-recipe/image_types_wic.bbclass
@@ -57,6 +57,16 @@  def wks_search(files, search_path):
             if searched:
                 return searched
 
+def wks_checksums(files, search_path):
+    ret = ""
+    for f in files:
+        found, hist = bb.utils.which(search_path, f, history=True)
+        ret = ret + " " + " ".join(h + ":False" for h in hist[:-1])
+        if found:
+            ret = ret + " " + found + ":True"
+    return ret
+
+
 WIC_CREATE_EXTRA_ARGS ?= ""
 
 IMAGE_CMD:wic () {
@@ -98,7 +108,7 @@  do_image_wic[cleandirs] = "${WORKDIR}/build-wic"
 
 # Rebuild when the wks file or vars in WICVARS change
 USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
-WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}"
+WKS_FILE_CHECKSUM = "${@wks_checksums(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH')) if '${USING_WIC}' else ''}"
 do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
 do_image_wic[depends] += "${@' '.join('%s-native:do_populate_sysroot' % r for r in ('parted', 'gptfdisk', 'dosfstools', 'mtools'))}"