[OE-core] delayed assignment and "+=" and IMAGE_FEATURES

Robert P. J. Day rpjday at crashcourse.ca
Sat Mar 31 19:07:06 UTC 2012


  another sort of "best practices" question while trying to dispel
some confusion.  in bitbake.conf, we have:

IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"

fair enough, but since this is in bitbake.conf, it clearly(?)
represents delayed processing since this is being defined before the
target task or recipe has even started being parsed.  so how is that
explained such that users can understand what they're allowed to do
with those two variables in subsequent task or recipe files?

  but wait ... there's more.

the default local.conf immediately extends this with:

EXTRA_IMAGE_FEATURES = "debug-tweaks"

so at this point, before parsing the recipe or task file, the user
really should understand that they can do a number of things:

* append to IMAGE_FEATURES if they want more features
* append to EXTRA_IMAGE_FEATURES if they want more features
* assign to EXTRA_IMAGE_FEATURES if they want to override that
  setting from local.conf (silly since they might as well just
  change local.conf)
* assign to IMAGE_FEATURES if they want to totally override the
  recipe they're about to inherit (kinda weird)

  core-image.bbclass then defines:

X11_IMAGE_FEATURES  = "x11-base apps-x11-core package-management"
ENHANCED_IMAGE_FEATURES = "${X11_IMAGE_FEATURES} apps-x11-games apps-x11-pimlico package-management"
SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ssh-server-dropbear"

so if we're going to inherit from core-image, we have all of this
available, so let's see some examples (just the relevant lines):

  here's core-image-base.bb:

IMAGE_FEATURES += "apps-console-core"
inherit core-image

ok, so we're adding that package group to our image.  is there any
difference if we had done done this instead?

EXTRA_IMAGE_FEATURES += "apps-console-core"
inherit core-image

it would seem that the end result for *this* class would be exactly
the same.  but it *might* make a difference if someone defined a new
recipe that included core-image-base.bb based on what happened in that
new recipe, yes?

  here's core-image-core.bb:

IMAGE_FEATURES += "apps-console-core ${X11_IMAGE_FEATURES}"
inherit core-image

same observation here, of course, unless there's something i'm
missing.

  finally, there's recipes-rt/images/core-image-rt-sdk.bb:

require recipes-core/images/core-image-minimal.bb

IMAGE_FEATURES += "dev-pkgs tools-sdk"
EXTRA_IMAGE_FEATURES += "tools-debug tools-profile tools-testapps debug-tweaks"

what's the value in breaking those features over the two variables
that are simply combined at the end?

  anyway, just looking for best practices given that some of the
recipe files are a bit confusing.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================




More information about the Openembedded-core mailing list