Bug 9283 - Document conditional inherits
Summary: Document conditional inherits
Status: RESOLVED FIXED
Alias: None
Product: BitBake User Manual
Classification: Documentation
Component: bitbake-manual (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 2.1 M4
Assignee: Scott Rifenbark
QA Contact:
URL:
Whiteboard: 21 March 2016: RESOLVED
Depends on:
Blocks:
 
Reported: 2016-03-17 02:47 UTC by Paul Eggleton
Modified: 2016-03-22 20:34 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Done (doc changes complete)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2016-03-17 02:47:25 UTC
Under "3.3.2. inherit Directive" in the BitBake manual we should add some information at the end mentioning that you can do conditional inherits by using a variable expression after the inherit i.e.

inherit ${VARNAME}

If VARNAME is going to be set it needs to be set before the inherit statement is parsed (possibly achieving conditionality using overrides or through an anonymous python function). If the variable evaluates to an empty string the statement will not trigger a syntax error i.e. it becomes a no-op.

Of course an in-line Python expression is also permissible e.g.

inherit ${@'classname' if condition else ''}
inherit ${@functionname(params)}


This brings up a tangential point - we don't currently explain in-line Python; we do mention it in passing but we ought to have a small section on it in the BitBake manual.
Comment 1 Scott Rifenbark 2016-03-22 20:34:06 UTC
Worked with Paul to interactively fix this up.  Here is the link: http://www.yoctoproject.org/docs/2.1/bitbake-user-manual/bitbake-user-manual.html#inherit-directive.  

I am marking it RESOLVED and setting the doc flag to "done".

Scott