[PATCH 7/7] parse/ast: skip empty BBPATH segments in include_all
AdrianF <[email protected]>
| Newsgroups | org.openembedded.lists.bitbake-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Adrian Freihofer <[email protected]> BBPATH can end up with an empty ":"-split segment when different layer.conf files mix the "${LAYERDIR}:" (prepend) and ":${LAYERDIR}" (append) idioms, e.g. openembedded-core's own meta/conf/layer.conf uses "BBPATH .= \":${LAYERDIR}\"" while every other layer.conf in a typical poky setup uses "BBPATH =. \"${LAYERDIR}:\"". Combined, this produces a literal "::" in the final value. IncludeAllNode.eval() iterates every BBPATH segment and calls os.path.join(path, s) to build the candidate file to include. For an empty segment, os.path.join("", s) returns s unchanged, i.e. a relative path instead of an absolute one. include_single_file() then takes its relative-path branch, which does its own independent search across the whole BBPATH and marks every path it tries (found or not) as a dependency via mark_dependency(), as a side effect of resolving that one (bogus) relative candidate. If that side search happens to try the real target file before this loop's own iteration for its actual BBPATH entry runs, check_dependency() reports it as already seen and include_single_file() logs a spurious "Duplicate inclusion" warning for it, even though the file is only ever included once. This is how e.g. oe-core's "include_all conf/distro/include/maintainers.inc" in defaultsetup.conf ends up warning about itself on every parse. Skip empty segments so an empty BBPATH entry cannot trigger this false-positive dependency marking. AI-Generated: Uses GitHub Copilot Signed-off-by: Adrian Freihofer <[email protected]> --- lib/bb/parse/ast.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py index a372b3534..866ab8ed1 100644 --- a/lib/bb/parse/ast.py +++ b/lib/bb/parse/ast.py @@ -56,6 +56,10 @@ class IncludeAllNode(AstNode): logger.debug2("CONF %s:%s: including %s", self.filename, self.lineno, s) for path in data.getVar("BBPATH").split(":"): + # Skip empty segments (e.g. from a stray "::" if some layer.conf + # uses ".= \":${LAYERDIR}\"" instead of "=. \"${LAYERDIR}:\""). + if not path: + continue bb.parse.ConfHandler.include(self.filename, os.path.join(path, s), self.lineno, data, False) class ExportNode(AstNode): -- 2.55.0