Skip to contentSkip to conversation

Follow up patches for default features

PATCH New Paul Barker 1 participant 4 messages Apr 3

lore
Share & tools
lore
#0 lore raw

cover Follow up patches for default features

As discussed on the patch review call and IRC, here are a couple of follow-ups to the default feature handling for DISTRO_FEATURES & MACHINE_FEATURES.

---
Paul Barker (3):
bitbake.conf: Document renamed default machine/distro features vars
oelib: utils: Support opting out of all features
oelib: utils: Fix description of set_difference

 meta/conf/bitbake.conf |  7 +++++++
 meta/lib/oe/utils.py   | 12 +++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

---
base-commit: e954a94b5b528b2430e8da331107d7d58287f89b
change-id: 20260403-default-features-2-ce5d3037ff7d

Best regards,

Signature · 1 line
Paul Barker
#1 lore raw

PATCH 1/3 bitbake.conf: Document renamed default machine/distro features vars

Adding support for opting out of any machine/distro features has obsoleted a few variables, add them to BB_RENAMED_VARIABLES so that users get an error if they try to use the old names.

---
 meta/conf/bitbake.conf | 7 +++++++
 1 file changed, 7 insertions(+)
meta/conf/bitbake.conf +7 -0
index 84450386d984..9fcd16615db5 100644
@@ -121,6 +121,13 @@ BB_RENAMED_VARIABLES[WHITELIST_GPL-3.0+] = "is deprecated, convert to INCOMPATIB
 BB_RENAMED_VARIABLES[WHITELIST_LGPL-3.0] = "is deprecated, convert to INCOMPATIBLE_LICENSE_EXCEPTIONS = '<pkg>:LGPL-3.0-only'"
 BB_RENAMED_VARIABLES[WHITELIST_LGPL-3.0+] = "is deprecated, convert to INCOMPATIBLE_LICENSE_EXCEPTIONS = '<pkg>:LGPL-3.0-or-later'"
 
+BB_RENAMED_VARIABLES[DISTRO_FEATURES_DEFAULT] = "is obsolete, add all default features to DISTRO_FEATURES_DEFAULTS"
+BB_RENAMED_VARIABLES[DISTRO_FEATURES_BACKFILL] = "is obsolete, add all default features to DISTRO_FEATURES_DEFAULTS"
+BB_RENAMED_VARIABLES[DISTRO_FEATURES_BACKFILL_CONSIDERED] = "DISTRO_FEATURES_OPTED_OUT"
+BB_RENAMED_VARIABLES[MACHINE_FEATURES_DEFAULT] = "is obsolete, add all default features to MACHINE_FEATURES_DEFAULTS"
+BB_RENAMED_VARIABLES[MACHINE_FEATURES_BACKFILL] = "is obsolete, add all default features to MACHINE_FEATURES_DEFAULTS"
+BB_RENAMED_VARIABLES[MACHINE_FEATURES_BACKFILL_CONSIDERED] = "MACHINE_FEATURES_OPTED_OUT"
+
 ##################################################################
 # Architecture-dependent build variables.
 ##################################################################
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/3 oelib: utils: Support opting out of all features

In reply to Paul Barker

If '*' is present as a separate token in DISTRO_FEATURES_OPTED_OUT or MACHINE_FEATURES_OPTED_OUT, interpret this as opting out of all default features.

If '*' is part of a larger word, this is not treated specially - 'FOO*' will not trigger removal of all features.

This is implemented in set_difference() so that the behaviour can be reused in other similar processing we may need to do in the future.

---
 meta/lib/oe/utils.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/lib/oe/utils.py +10 -0
index 5c722d230842..639c037c1a01 100644
@@ -93,6 +93,13 @@ def set_difference(variable1, variable2, d):
     s2 = "b c d"
     s3 = set_difference(s1, s2)
     => s3 = "a"
+
+    If '*' is present as a separate token (not part of a larger identifier) in
+    the second operand, this is interpreted as "remove all entries":
+    s1 = "a b c"
+    s2 = "*"
+    s3 = set_difference(s1, s2)
+    => s3 = ""
     """
     val1 = d.getVar(variable1)
     if not val1:
@@ -104,6 +111,9 @@ def set_difference(variable1, variable2, d):
     val1 = set(val1.split())
     val2 = set(val2.split())
 
+    if "*" in val2:
+        return ""
+
     # Return a sorted string to ensure that the result is consistent between
     # parser runs.
     return " ".join(sorted(val1 - val2))
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/3 oelib: utils: Fix description of set_difference

In reply to Paul Barker

Forgot to change the description when copy-pasting from set_intersect().

---
 meta/lib/oe/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/utils.py +1 -1
index 639c037c1a01..ed5dd5f45049 100644
@@ -86,7 +86,7 @@ def set_intersect(variable1, variable2, d):
 def set_difference(variable1, variable2, d):
     """
     Expand both variables, interpret them as lists of strings, and return the
-    intersection as a flattened string.
+    difference as a flattened string.
 
     For example:
     s1 = "a b c"
Signature · 1 line
2.43.0