Skip to content

Commit e7efd65

Browse files
committed
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 <richard.purdie@linuxfoundation.org>
1 parent 396cb0f commit e7efd65

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

meta/classes-global/base.bbclass

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,19 @@ def buildcfg_neededvars(d):
267267
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))
268268

269269
addhandler base_eventhandler
270-
base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed"
270+
base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed bb.event.RecipePreDeferredInherits"
271271
python base_eventhandler() {
272272
import bb.runqueue
273273

274+
if isinstance(e, bb.event.RecipePreDeferredInherits):
275+
# Use this to snoop on class extensions and set these up before the deferred inherits
276+
# are processed which allows overrides on conditional variables.
277+
if "native" in e.inherits:
278+
d.setVar('CLASSOVERRIDE', 'class-native')
279+
elif "nativesdk" in e.inherits:
280+
d.setVar('CLASSOVERRIDE', 'class-nativesdk')
281+
return
282+
274283
if isinstance(e, bb.event.ConfigParsed):
275284
if not d.getVar("NATIVELSBSTRING", False):
276285
d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d))

0 commit comments

Comments
 (0)