Skip to contentSkip to conversation

DISTRO_FEATURES_BACKFILL implementation

RFC PATCH New Paul Eggleton 1 participant 2 messages Feb 21, 2012

lore
Share & tools
lore
#0 lore raw

cover DISTRO_FEATURES_BACKFILL implementation

Implements DISTRO_FEATURES_BACKFILL to allow introducing new DISTRO_FEATURES that control existing functionality without breaking existing distro configuration, as discussed in the following thread:

http://article.gmane.org/gmane.comp.handhelds.openembedded.core/13033

Please review the following changes for suitability for inclusion. If you have any objections or suggestions for improvement, please respond to the patches. If you agree with the changes, please provide your Acked-by.

The following changes since commit 1da6a2dbd5e7aeea6cd45ca05590bdd50b67bf89:

recipes: bump PR to rebuild .la files without libz.la (2012-02-21 15:00:24 +0000)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/distro-features-backfill
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/distro-features-backfill

Paul Eggleton (1):
conf/bitbake.conf: add DISTRO_FEATURES_BACKFILL

 meta/conf/bitbake.conf |    3 +++
 meta/lib/oe/utils.py   |   20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

RFC PATCH 1/1 conf/bitbake.conf: add DISTRO_FEATURES_BACKFILL

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].

---
 meta/conf/bitbake.conf |    3 +++
 meta/lib/oe/utils.py   |   20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
meta/conf/bitbake.conf +3 -0
index 90e5f7a..2539ae0 100644
@@ -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)} \
meta/lib/oe/utils.py +20 -0
index 95daace..2aaed3a 100644
@@ -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 ""
Signature · 1 line
1.7.5.4