bitbake: ast/BBHandler: Add support for BB_DEFER_BBCLASSES

Add support for automatically promoting class inherits to deferred inherits
by listing them in the BB_DEFER_BBCLASSES variable.

(Bitbake rev: 8e741b2e885a12d119788d04aa4efcd724dd6bfa)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2025-06-06 17:44:32 +01:00
parent e20af03c02
commit 32e44e2866
2 changed files with 12 additions and 6 deletions

View File

@@ -42,12 +42,22 @@ def supports(fn, d):
"""Return True if fn has a supported extension"""
return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"]
def inherit_defer(expression, fn, lineno, d):
inherit = (expression, fn, lineno)
inherits = d.getVar('__BBDEFINHERITS', False) or []
inherits.append(inherit)
d.setVar('__BBDEFINHERITS', inherits)
def inherit(files, fn, lineno, d, deferred=False):
__inherit_cache = d.getVar('__inherit_cache', False) or []
#if "${" in files and not deferred:
# bb.warn("%s:%s has non deferred conditional inherit" % (fn, lineno))
files = d.expand(files).split()
for file in files:
defer = (d.getVar("BB_DEFER_BBCLASSES") or "").split()
if not deferred and file in defer:
inherit_defer(file, fn, lineno, d)
continue
classtype = d.getVar("__bbclasstype", False)
origfile = file
for t in ["classes-" + classtype, "classes"]: