Bug 15795

Summary: Python library code changes don't cause rebuild, and trigger taskhash mismatch
Product: [Build System, Metadata & Runtime] BitBake Reporter: Joshua Watt <JPEWhacker>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: poky.bs.watcher, poky.watcher, randy.macleod
Version: unspecified   
Target Milestone: 5.2 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Joshua Watt 2025-03-12 18:24:28 UTC
There appears to be a problem where bitbake will not detect that changes are made to python library code and recalculate hashes appropriately. This not only means that tasks aren't rerun when they should be, but also that taskhash mismatches can easily occur.

This appear to be easily reproduced with the following steps:

$ bitbake core-image-minimal

edit spdx30_tasks.py:create_spdx() by adding extra whitespace

$ bitbake core-image-minimal

Note that no tasks rerun, even though the task changed

invalidate and run an upstream task with:

$ bitbake -f --runall collect_spdx_deps core-image-minimal

Many task hash mismatch errors will occur
Comment 1 Richard Purdie 2025-03-12 18:44:34 UTC
You can see this a little faster with:

bitbake core-image-minimal -c clean

bitbake core-image-minimal -S none

ls -1la tmp/stamps/qemux86_64-poky-linux/core-image-minimal/

<edit spdx30_tasks.py:create_spdx() by adding extra whitespace>

bitbake core-image-minimal -S none

ls -1la tmp/stamps/qemux86_64-poky-linux/core-image-minimal/

(shows the same as above)

rm tmp/cache/ -rf

bitbake core-image-minimal -S none

ls -1la tmp/stamps/qemux86_64-poky-linux/core-image-minimal/

shows duplicate sigdata files with new hashes (do_build for example changes)
Comment 2 Richard Purdie 2025-03-12 18:46:41 UTC
I think the problem is that whilst bitbake reparses it's configuration, we don't know when to reparse the recipes since we don't know which hashes of which functions make it into which recipes. This means we don't know whether to load a recipe's values from the cache or not.
Comment 3 Richard Purdie 2025-03-12 18:48:59 UTC
Put another way, if the overall checksum of "lib" changes at all, we need to invalidate the cache and reparse everything
Comment 4 Richard Purdie 2025-03-13 13:34:35 UTC
The issue is the base configuration hash doesn't account for the module dependencies. I've sent a patch.