diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-06 11:44:43 +0100 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2025-06-11 08:17:34 -0700 |
commit | 320b76cc477069d619fd44d28608d9d2c1efe77c (patch) | |
tree | 0a591d806cd692e033c92051cc21bd10940ec7b4 | |
parent | 4bca6762e5baa7c8cb90b4f2f13f4cb3e2e9942e (diff) | |
download | poky-320b76cc477069d619fd44d28608d9d2c1efe77c.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: 139f61fe9eec221745184a14b3618d2dfa650b91)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 7581d003fd..327e45c8ac 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -391,6 +391,14 @@ def finalize(fn, d, variant = None): | |||
391 | if d.getVar("_FAILPARSINGERRORHANDLED", False) == True: | 391 | if d.getVar("_FAILPARSINGERRORHANDLED", False) == True: |
392 | raise bb.BBHandledException() | 392 | raise bb.BBHandledException() |
393 | 393 | ||
394 | while True: | ||
395 | inherits = d.getVar('__BBDEFINHERITS', False) or [] | ||
396 | if not inherits: | ||
397 | break | ||
398 | inherit, filename, lineno = inherits.pop(0) | ||
399 | d.setVar('__BBDEFINHERITS', inherits) | ||
400 | bb.parse.BBHandler.inherit(inherit, filename, lineno, d, deferred=True) | ||
401 | |||
394 | for var in d.getVar('__BBHANDLERS', False) or []: | 402 | for var in d.getVar('__BBHANDLERS', False) or []: |
395 | # try to add the handler | 403 | # try to add the handler |
396 | handlerfn = d.getVarFlag(var, "filename", False) | 404 | handlerfn = d.getVarFlag(var, "filename", False) |
@@ -444,14 +452,6 @@ def multi_finalize(fn, d): | |||
444 | logger.debug("Appending .bbappend file %s to %s", append, fn) | 452 | logger.debug("Appending .bbappend file %s to %s", append, fn) |
445 | bb.parse.BBHandler.handle(append, d, True) | 453 | bb.parse.BBHandler.handle(append, d, True) |
446 | 454 | ||
447 | while True: | ||
448 | inherits = d.getVar('__BBDEFINHERITS', False) or [] | ||
449 | if not inherits: | ||
450 | break | ||
451 | inherit, filename, lineno = inherits.pop(0) | ||
452 | d.setVar('__BBDEFINHERITS', inherits) | ||
453 | bb.parse.BBHandler.inherit(inherit, filename, lineno, d, deferred=True) | ||
454 | |||
455 | onlyfinalise = d.getVar("__ONLYFINALISE", False) | 455 | onlyfinalise = d.getVar("__ONLYFINALISE", False) |
456 | 456 | ||
457 | safe_d = d | 457 | safe_d = d |
@@ -487,7 +487,9 @@ def multi_finalize(fn, d): | |||
487 | d.setVar("BBEXTENDVARIANT", variantmap[name]) | 487 | d.setVar("BBEXTENDVARIANT", variantmap[name]) |
488 | else: | 488 | else: |
489 | d.setVar("PN", "%s-%s" % (pn, name)) | 489 | d.setVar("PN", "%s-%s" % (pn, name)) |
490 | bb.parse.BBHandler.inherit(extendedmap[name], fn, 0, d) | 490 | inherits = d.getVar('__BBDEFINHERITS', False) or [] |
491 | inherits.append((extendedmap[name], fn, 0)) | ||
492 | d.setVar('__BBDEFINHERITS', inherits) | ||
491 | 493 | ||
492 | safe_d.setVar("BBCLASSEXTEND", extended) | 494 | safe_d.setVar("BBCLASSEXTEND", extended) |
493 | _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise) | 495 | _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise) |