]> code.ossystems Code Review - openembedded-core.git/commitdiff
conf/bitbake.conf: add DISTRO_FEATURES_BACKFILL
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 23 Feb 2012 19:26:09 +0000 (19:26 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 24 Feb 2012 16:36:46 +0000 (16:36 +0000)
When introducing new items to DISTRO_FEATURES that control functionality
that is already enabled, in order to leave existing distro configuration
unchanged we need a way to "backfill" these new feature items onto the
existing DISTRO_FEATURES value.

This introduces a DISTRO_FEATURES_BACKFILL variable whose items will be
added to the end of DISTRO_FEATURES, unless they also appear in
DISTRO_FEATURES_BACKFILL_CONSIDERED which distros can use in their
configuration to prevent specific items from being added.

Fixes [YOCTO #1946].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/conf/bitbake.conf
meta/lib/oe/utils.py

index 90e5f7a3bc96dfacbcf84c115dfe2e4f9c91116f..2539ae0f0ab604cdcbe462752abec714a2ca844a 100644 (file)
@@ -694,6 +694,9 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
 IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
 
+DISTRO_FEATURES_BACKFILL = ""
+DISTRO_FEATURES_append = "${@oe.utils.distro_features_backfill(d)}"
+
 COMBINED_FEATURES = "\
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "alsa", d)} \
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "bluetooth", d)} \
index 02d5442940678297911165a731e960ee6adabaa5..8912dac3bb9ef6749d41cd7e141f6d358f15c99c 100644 (file)
@@ -88,3 +88,23 @@ def param_bool(cfg, field, dflt = None):
 def inherits(d, *classes):
     """Return True if the metadata inherits any of the specified classes"""
     return any(bb.data.inherits_class(cls, d) for cls in classes)
+
+def distro_features_backfill(d):
+    # This construct allows the addition of new features to DISTRO_FEATURES
+    # that if not present would disable existing functionality, without
+    # disturbing distributions that have already set DISTRO_FEATURES.
+    # Distributions wanting to elide a value in DISTRO_FEATURES_BACKFILL should
+    # add the feature to DISTRO_FEATURES_BACKFILL_CONSIDERED
+
+    backfill = (d.getVar("DISTRO_FEATURES_BACKFILL", True) or "").split()
+    considered = (d.getVar("DISTRO_FEATURES_BACKFILL_CONSIDERED", True) or "").split()
+
+    addfeatures = []
+    for feature in backfill:
+        if feature not in considered:
+            addfeatures.append(feature)
+
+    if addfeatures:
+        return " %s" % (" ".join(addfeatures))
+    else:
+        return ""