Skip to contentSkip to conversation

busybox: fix DISTRO_FEATURES detection

PATCH New Ross Burton 1 participant 1 message Apr 7

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 busybox: fix DISTRO_FEATURES detection

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")

---
 meta/recipes-core/busybox/busybox.inc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
meta/recipes-core/busybox/busybox.inc +4 -5
index 355c019738..916ad11f80 100644
@@ -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}
Signature · 1 line
2.47.1