diff mbox series

[v2] busybox: fix DISTRO_FEATURES detection

Message ID 20260407162337.1227714-1-ross.burton@arm.com
State New
Headers show
Series [v2] busybox: fix DISTRO_FEATURES detection | expand

Commit Message

Ross Burton April 7, 2026, 4:23 p.m. UTC
Changes to how DISTRO_FEATURES is evaluated meant that busybox was using
a partial DISTRO_FEATURES and thus disabling features it should not be.
This is due to the use of immediate assignments which are evaulated
before the final value is calculated (by anonymous Python in base.bbclass).

Remove entirely DO_IPv4/DO_IPv6 as they're used once, replacing with
inline bb.utils.contains_any().

Remove the immediate assignments to OE_FEATURES/OE_DEL so that they are
evaluated on use. The evaluation is expensive, but it only happens once.

[1] oe-core 159148f4de ("meta: Support opting out of any distro features")

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/busybox/busybox.inc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 355c019738..916ad11f80 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -101,10 +101,8 @@  def features_to_busybox_del(d):
 
 configmangle = '/CONFIG_EXTRA_CFLAGS/d; \
 		'
-OE_FEATURES := "${@features_to_busybox_conf(d)}"
-OE_DEL      := "${@features_to_busybox_del(d)}"
-DO_IPv4 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv4', 1, 0, d)}"
-DO_IPv6 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)}"
+OE_FEATURES = "${@features_to_busybox_conf(d)}"
+OE_DEL      = "${@features_to_busybox_del(d)}"
 
 python () {
   if "${OE_DEL}":
@@ -129,7 +127,8 @@  do_prepare_config () {
 	for i in 'CROSS' 'DISTRO FEATURES'; do echo "### $i"; done >> \
 		${S}/.config
 	sed -i -e '${configmangle}' ${S}/.config
-	if test ${DO_IPv4} -eq 0 && test ${DO_IPv6} -eq 0; then
+
+	if ! ${@bb.utils.contains_any('DISTRO_FEATURES', 'ipv4 ipv6', 'true', 'false', d)}; then
 		# disable networking applets
 		mv ${S}/.config ${S}/.config.oe-tmp
 		awk 'BEGIN{net=0}