summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/ast.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-06-06 11:44:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-06-16 22:23:18 +0100
commitf2a15854e2ed9d6e5be395bfe2b92f8fed6f897a (patch)
treeb66e2829520a70ad17f3629f37aedb69cae82823 /bitbake/lib/bb/parse/ast.py
parente000d803bf9768f698a6f83acf44227bc9408f33 (diff)
downloadpoky-f2a15854e2ed9d6e5be395bfe2b92f8fed6f897a.tar.gz
bitbake: ast: Change deferred inherits to happen per recipe
Currently deferred inherits get processed once for all class extensions as a minor speed optimisation. Unfortunately this limits our options for being able to report deferred classes to our code. There are two challenges with using our deferred classes in OE at present. One is that PACKAGECONFIG values don't work well with class overrides like class-native if there are deferred classes based on PACKAGECONFIG, such as python support. The second is that toolchain selection is proving problematic to implement due to interactions between the toolchain deferred inherit, the class extensions and class overrides being very late. By changing deferred inherits to be recipe extension specific, we open the way to generate events and "peek" at where things will end up, allowing the class overrides to be set earlier. The class extension code is updated to use a deferred inherit for the class extension inheriting so that it is still inherited last. (Bitbake rev: 29277cf4d88eb4dfa9572851177d009eab5afd0c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse/ast.py')
-rw-r--r--bitbake/lib/bb/parse/ast.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 290ed45048..f9998798d8 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -471,6 +471,14 @@ def finalize(fn, d, variant = None):
471 if d.getVar("_FAILPARSINGERRORHANDLED", False) == True: 471 if d.getVar("_FAILPARSINGERRORHANDLED", False) == True:
472 raise bb.BBHandledException() 472 raise bb.BBHandledException()
473 473
474 while True:
475 inherits = d.getVar('__BBDEFINHERITS', False) or []
476 if not inherits:
477 break
478 inherit, filename, lineno = inherits.pop(0)
479 d.setVar('__BBDEFINHERITS', inherits)
480 bb.parse.BBHandler.inherit(inherit, filename, lineno, d, deferred=True)
481
474 for var in d.getVar('__BBHANDLERS', False) or []: 482 for var in d.getVar('__BBHANDLERS', False) or []:
475 # try to add the handler 483 # try to add the handler
476 handlerfn = d.getVarFlag(var, "filename", False) 484 handlerfn = d.getVarFlag(var, "filename", False)
@@ -525,14 +533,6 @@ def multi_finalize(fn, d):
525 logger.debug("Appending .bbappend file %s to %s", append, fn) 533 logger.debug("Appending .bbappend file %s to %s", append, fn)
526 bb.parse.BBHandler.handle(append, d, True) 534 bb.parse.BBHandler.handle(append, d, True)
527 535
528 while True:
529 inherits = d.getVar('__BBDEFINHERITS', False) or []
530 if not inherits:
531 break
532 inherit, filename, lineno = inherits.pop(0)
533 d.setVar('__BBDEFINHERITS', inherits)
534 bb.parse.BBHandler.inherit(inherit, filename, lineno, d, deferred=True)
535
536 onlyfinalise = d.getVar("__ONLYFINALISE", False) 536 onlyfinalise = d.getVar("__ONLYFINALISE", False)
537 537
538 safe_d = d 538 safe_d = d
@@ -568,7 +568,9 @@ def multi_finalize(fn, d):
568 d.setVar("BBEXTENDVARIANT", variantmap[name]) 568 d.setVar("BBEXTENDVARIANT", variantmap[name])
569 else: 569 else:
570 d.setVar("PN", "%s-%s" % (pn, name)) 570 d.setVar("PN", "%s-%s" % (pn, name))
571 bb.parse.BBHandler.inherit(extendedmap[name], fn, 0, d) 571 inherits = d.getVar('__BBDEFINHERITS', False) or []
572 inherits.append((extendedmap[name], fn, 0))
573 d.setVar('__BBDEFINHERITS', inherits)
572 574
573 safe_d.setVar("BBCLASSEXTEND", extended) 575 safe_d.setVar("BBCLASSEXTEND", extended)
574 _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise) 576 _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise)