summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-06-06 17:44:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-06-16 22:23:18 +0100
commit32e44e286692b0aac10a3887a0231e8cd772f082 (patch)
tree70d79914d413ac201232ef2779ba59adedd2a309 /bitbake/lib
parente20af03c0210a0a0af1a5daad7cf859ea3e70cc5 (diff)
downloadpoky-32e44e286692b0aac10a3887a0231e8cd772f082.tar.gz
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>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/parse/ast.py8
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py10
2 files changed, 12 insertions, 6 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 5a086b4e95..ea1096f2de 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -340,9 +340,7 @@ class InheritDeferredNode(AstNode):
340 self.inherit = (classes, filename, lineno) 340 self.inherit = (classes, filename, lineno)
341 341
342 def eval(self, data): 342 def eval(self, data):
343 inherits = data.getVar('__BBDEFINHERITS', False) or [] 343 bb.parse.BBHandler.inherit_defer(*self.inherit, data)
344 inherits.append(self.inherit)
345 data.setVar('__BBDEFINHERITS', inherits)
346 344
347class AddFragmentsNode(AstNode): 345class AddFragmentsNode(AstNode):
348 def __init__(self, filename, lineno, fragments_path_prefix, fragments_variable, flagged_variables_list_variable): 346 def __init__(self, filename, lineno, fragments_path_prefix, fragments_variable, flagged_variables_list_variable):
@@ -571,9 +569,7 @@ def multi_finalize(fn, d):
571 d.setVar("BBEXTENDVARIANT", variantmap[name]) 569 d.setVar("BBEXTENDVARIANT", variantmap[name])
572 else: 570 else:
573 d.setVar("PN", "%s-%s" % (pn, name)) 571 d.setVar("PN", "%s-%s" % (pn, name))
574 inherits = d.getVar('__BBDEFINHERITS', False) or [] 572 bb.parse.BBHandler.inherit_defer(extendedmap[name], fn, 0, d)
575 inherits.append((extendedmap[name], fn, 0))
576 d.setVar('__BBDEFINHERITS', inherits)
577 573
578 safe_d.setVar("BBCLASSEXTEND", extended) 574 safe_d.setVar("BBCLASSEXTEND", extended)
579 _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise) 575 _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise)
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 4bdb11994f..008fec2308 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -42,12 +42,22 @@ def supports(fn, d):
42 """Return True if fn has a supported extension""" 42 """Return True if fn has a supported extension"""
43 return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"] 43 return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"]
44 44
45def inherit_defer(expression, fn, lineno, d):
46 inherit = (expression, fn, lineno)
47 inherits = d.getVar('__BBDEFINHERITS', False) or []
48 inherits.append(inherit)
49 d.setVar('__BBDEFINHERITS', inherits)
50
45def inherit(files, fn, lineno, d, deferred=False): 51def inherit(files, fn, lineno, d, deferred=False):
46 __inherit_cache = d.getVar('__inherit_cache', False) or [] 52 __inherit_cache = d.getVar('__inherit_cache', False) or []
47 #if "${" in files and not deferred: 53 #if "${" in files and not deferred:
48 # bb.warn("%s:%s has non deferred conditional inherit" % (fn, lineno)) 54 # bb.warn("%s:%s has non deferred conditional inherit" % (fn, lineno))
49 files = d.expand(files).split() 55 files = d.expand(files).split()
50 for file in files: 56 for file in files:
57 defer = (d.getVar("BB_DEFER_BBCLASSES") or "").split()
58 if not deferred and file in defer:
59 inherit_defer(file, fn, lineno, d)
60 continue
51 classtype = d.getVar("__bbclasstype", False) 61 classtype = d.getVar("__bbclasstype", False)
52 origfile = file 62 origfile = file
53 for t in ["classes-" + classtype, "classes"]: 63 for t in ["classes-" + classtype, "classes"]: