bitbake.conf: DISTRO_FEATURES as overrides

As discussed in "[Openembedded-architecture] Yocto Compatible 2.0 +
signature changes", changes in .bbappend must depend on some explicit
configuration change, typically selecting a distro feature.

For _append and _remove, adding an override that is set only when the
corresponding entry is in DISTRO_FEATURES achieves that:

In local.conf:
  DISTRO_FEATURES_append = " my-distro-feature"

In layer.conf:
  DISTRO_FEATURES_OVERRIDES += "my-distro-feature"

In a .bbappend:
  do_install_append_df-my-distro-feature () {
       ...
  }

The subset of DISTRO_FEATURES that are made available as overrides
must be configured explicitly because using them this way should
be a conscious decision.

(From OE-Core rev: 3b3ae91a22d6f685e804df4f32cdeebe1bd6bd88)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Patrick Ohly
2017-06-09 15:04:03 +02:00
committed by Richard Purdie
parent 6bb9860ef7
commit 7b95d5d701

View File

@@ -713,7 +713,7 @@ DISTRO_NAME ??= "OpenEmbedded"
#
# This works for functions as well, they are really just environment variables.
# Default OVERRIDES to make compilation fail fast in case of build system misconfiguration.
OVERRIDES = "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:build-${BUILD_OS}:pn-${PN}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}:forcevariable"
OVERRIDES = "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:build-${BUILD_OS}:pn-${PN}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}${DISTROFEATURESOVERRIDES}:${CLASSOVERRIDE}:forcevariable"
OVERRIDES[vardepsexclude] = "MACHINEOVERRIDES"
CLASSOVERRIDE ?= "class-target"
DISTROOVERRIDES ?= "${@d.getVar('DISTRO') or ''}"
@@ -722,6 +722,21 @@ MACHINEOVERRIDES[vardepsexclude] = "MACHINE"
FILESOVERRIDES = "${TRANSLATED_TARGET_ARCH}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}"
# Turns certain DISTRO_FEATURES into overrides of the same name
# or (optionally) some other name. Ensures that these special
# distro features remain set also for native and nativesdk
# recipes, so that these overrides can also be used there.
#
# Beware that this part of OVERRIDES changes during parsing, so usage
# of these overrides should be limited to .bb and .bbappend files,
# because then DISTRO_FEATURES is final.
DISTRO_FEATURES_OVERRIDES ??= ""
DISTRO_FEATURES_OVERRIDES[doc] = "A space-separated list of <feature> entries. \
Each entry is added to OVERRIDES as df-<feature> if <feature> is in DISTRO_FEATURES."
DISTRO_FEATURES_FILTER_NATIVE_append = " ${DISTRO_FEATURES_OVERRIDES}"
DISTRO_FEATURES_FILTER_NATIVESDK_append = " ${DISTRO_FEATURES_OVERRIDES}"
DISTROFEATURESOVERRIDES = "${@ ''.join([':df-' + x for x in (set(d.getVar('DISTRO_FEATURES_OVERRIDES').split()) & set((d.getVar('DISTRO_FEATURES') or '').split()))]) }"
##################################################################
# Include the rest of the config files.
##################################################################