From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: adrian.freihofer@siemens.com, bitbake-devel@lists.openembedded.org
Subject: Re: [bitbake-devel] [PATCH v2 1/8] cooker: fix bitbake -b silently ignoring bbappends
Date: Tue, 25 Aug 2026 09:59:43 +0100 [thread overview]
Message-ID: <bb2d438e38745bd6679bbad08aa826f2c07019fa.camel@linuxfoundation.org> (raw)
In-Reply-To: <20260816221507.155861-2-adrian.freihofer@siemens.com>
On Mon, 2026-08-17 at 00:14 +0200, Adrian Freihofer via lists.openembedded.org wrote:
> From: Adrian Freihofer <adrian.freihofer@siemens.com>
>
> "bitbake -b <recipe.bb>" builds the recipe without applying any of its
> .bbappend files.
>
> buildFileInternal() resolves appends via
> self.collections[mc].get_file_appends(fn), but self.collections[mc] is
> only ever filled in by collect_bbfiles(), called from updateCache() -
> a path -b deliberately skips. matchFiles(), the one -b-path function
> that does call collect_bbfiles(), built a fresh CookerCollectFiles into
> a throwaway local instead of self.collections[mc], so the append list
> stayed empty (or, on a memory-resident server, stale from the last
> full parse - e.g. missing a devtool/externalsrc workspace .bbappend
> added since). Nothing warns that the built metadata differs from disk.
>
> Make matchFiles() refresh self.collections[mc] itself so the later
> append lookup for the same fn sees the same fresh collection.
>
> AI-Generated: Uses GitHub Copilot
>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
> lib/bb/cooker.py | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
> index 4b6ba3196..108551a60 100644
> --- a/lib/bb/cooker.py
> +++ b/lib/bb/cooker.py
> @@ -1322,8 +1322,10 @@ You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result in si
> if bf.startswith("/") or bf.startswith("../"):
> bf = os.path.abspath(bf)
>
> - collections = {mc: CookerCollectFiles(self.bbfile_config_priorities, mc)}
> - filelist, masked, searchdirs = collections[mc].collect_bbfiles(self.databuilder.mcdata[mc], self.databuilder.mcdata[mc])
> + # The only place the "bitbake -b" path fills in the bbappends which
> + # buildFileInternal() then reads back from self.collections[mc].
> + self.collections[mc] = CookerCollectFiles(self.bbfile_config_priorities, mc)
> + filelist, masked, searchdirs = self.collections[mc].collect_bbfiles(self.databuilder.mcdata[mc], self.databuilder.mcdata[mc])
> try:
> os.stat(bf)
> bf = os.path.abspath(bf)
I've had some time to stare at the code and I'm not convinced this is
the right way to fix things.
self.collections is usually setup by parseConfiguration, which does so:
def parseConfiguration(self):
[...]
self.handleCollections(self.data.getVar("BBFILE_COLLECTIONS"))
self.collections = {}
for mc in self.multiconfigs:
self.collections[mc] = CookerCollectFiles(self.bbfile_config_priorities, mc)
The call site you're patching in matchFiles() is only called by
matchFile(). matchFile() can be called as a tinfoil command directly,
by buildFileInternal() or by showEnvironment(). The last two both call
parseConfiguration() before matchFile.
matchFile from command.py set "matchFile.needconfig = False" so that
does not need a configuration. I'm not seeing anything using the
matchFile api call so perhaps we could just change needconfig to True.
The bottom line is that tinfoil probably needs that
CookerCollectFiles() call but the rest don't, self.collections should
be ok for the others.
The collect_bbfiles() call is harder. That comes from updateCache()
when parsing finishes, so it needs a full recipe parse.
Looking at the code in collect_bbfiles(), I'm not convinced it does
need a full parse first, it can run without that. The code in that
function is horrible as it sets self.overlayed and self.bbappends but
also gives return values.
My feeling is that the function should either return values, or set
self.* things, but not both. We might be able to make collect_bbfiles
run earlier in parseConfiguration and then skip calling it at all in
matchFiles if it is already available?
Regardless, just making this unconditionally overwrite self.collections
is definitely not an improvement to the current mess, it will just make
it harder to disentangle things later...
Cheers,
Richard
next prev parent reply other threads:[~2026-08-25 8:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 22:14 [PATCH v2 0/8] cooker/tinfoil: fix -b bbappend handling and add single-task prepared-task API AdrianF
2026-08-16 22:14 ` [PATCH v2 1/8] cooker: fix bitbake -b silently ignoring bbappends AdrianF
2026-08-25 8:59 ` Richard Purdie [this message]
2026-08-16 22:14 ` [PATCH v2 2/8] tests/cooker: add a shared bitbake-subprocess test base class AdrianF
2026-08-16 22:14 ` [PATCH v2 3/8] tests/cooker: add a bitbake -b bbappend test AdrianF
2026-08-16 22:14 ` [PATCH v2 4/8] command: fix setConfig coercing bool config values to truthy strings AdrianF
2026-08-16 22:14 ` [PATCH v2 5/8] cooker: add a buildFile mode that runs a single task AdrianF
2026-08-16 22:14 ` [PATCH v2 6/8] tinfoil: add a prepared task runner AdrianF
2026-08-16 22:14 ` [PATCH v2 7/8] tests/cooker: add TinfoilTests for run_prepared_task AdrianF
2026-08-16 22:14 ` [PATCH v2 8/8] parse/ast: skip empty BBPATH segments in include_all AdrianF
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=bb2d438e38745bd6679bbad08aa826f2c07019fa.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=adrian.freihofer@siemens.com \
--cc=bitbake-devel@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