From d58f94d5684332bd4fac3747688558bb261b9c63 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 6 Jun 2025 11:46:46 +0100 Subject: [PATCH] base: Add deferred class event handler Use the new deferred class event to set the class overrides earlier. This improves interaction of the override with PACKAGECONFIG values that control conditional inherits (such as python support). This also allows toolchain configuration in an easier and more user friendly way. Signed-off-by: Richard Purdie --- meta/classes-global/base.bbclass | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 8215969c7bb..4ac3b83eb5c 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass @@ -267,10 +267,19 @@ def buildcfg_neededvars(d): bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) addhandler base_eventhandler -base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed" +base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed bb.event.RecipePreDeferredInherits" python base_eventhandler() { import bb.runqueue + if isinstance(e, bb.event.RecipePreDeferredInherits): + # Use this to snoop on class extensions and set these up before the deferred inherits + # are processed which allows overrides on conditional variables. + for c in ['native', 'nativesdk', 'crosssdk', 'cross']: + if c in e.inherits: + d.setVar('CLASSOVERRIDE', 'class-' + c) + break + return + if isinstance(e, bb.event.ConfigParsed): if not d.getVar("NATIVELSBSTRING", False): d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) -- 2.47.3