[oe] Inheriting conditionally

Richard Purdie rpurdie at rpsys.net
Wed Aug 8 12:19:39 UTC 2007


Hi,

On Tue, 2007-08-07 at 18:23 -0500, Matt Hoosier wrote:
> I'm search for a syntax that will allow me to inherit from certain
> classes only when using a particular distribution. Is there some good
> way to do this, like maybe:
> 
>   python {
>     if bb.getVar("DISTRO") == "mydistro"
>       # some API call to add inherited class
>   }
> 
> The particular thing I want to accomplish is to use the update-rc.d
> functionality to start a daemon systemwide only when targeting my own
> distro; it's nonstandard and wouldn't be appropriate for most
> distributions.

I can't think of a way to do this 100% neatly, the following is my best
idea:

SYSTEMWIDEDAEMON = "dummy"
SYSTEMWIDEDAEMON_mydistro = "myspecialclass"

inherit ${SYSTEMWIDEDAEMON}

The ugly bit is it needs an empty dummy.bbclass.

A quick test here suggests it might be harmless to use "base" there
since base will always have already been included...

Cheers,

Richard






More information about the Openembedded-devel mailing list