diff mbox series

busybox: fix DISTRO_FEATURES detection

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

Commit Message

Ross Burton April 7, 2026, 4:10 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(-)

Comments

Jörg Sommer April 7, 2026, 4:22 p.m. UTC | #1
Ross Burton via lists.openembedded.org schrieb am Di 07. Apr, 17:10 (+0100):
> diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
> index 355c019738..1429da9f96 100644
> --- a/meta/recipes-core/busybox/busybox.inc
> +++ b/meta/recipes-core/busybox/busybox.inc
> @@ -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 not ${@bb.utils.contains_any('DISTRO_FEATURES', 'ipv4 ipv6', 'true', 'false', d)}; then

s/not/!/
Ross Burton April 7, 2026, 4:24 p.m. UTC | #2
On 7 Apr 2026, at 17:22, Jörg Sommer <joerg.sommer@navimatix.de> wrote:
> 
> s/not/!/

Thanks!  My brain is very slow at context-switching between python and shell, apparently. v2 sent.

Ross
diff mbox series

Patch

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 355c019738..1429da9f96 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 not ${@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}