| Message ID | 20260331-default-features-v2-2-f73b43d8bd57@pbarker.dev |
|---|---|
| State | Changes Requested |
| Headers | show |
| Series | Support opt-out of any default machine and distro features | expand |
On Tue Mar 31, 2026 at 9:29 PM CEST, Paul Barker wrote: > Add default values to DISTRO_FEATURES using the new > filter_default_features() function. > > This change obsoletes the variables DISTRO_FEATURES_BACKFILL and > DISTRO_FEATURES_BACKFILL_CONSIDERED. Instead, all defaults are added via > DISTRO_FEATURES_DEFAULTS and users can opt out of any of these using > DISTRO_FEATURES_OPTED_OUT. Hopefully the variable naming here is easier > for people to understand and remember. > > Migration notes: > > - If you have previously assigned DISTRO_FEATURES without using > DISTRO_FEATURES_DEFAULT, you will now get the default features added > automatically. You will need to review these and add any features you > do not want to use to DISTRO_FEATURES_OPTED_OUT. > > - DISTRO_FEATURES_DEFAULT is now unused, the new variable name is > slighlty different to ensure that it is not accidentally used if a > layer hasn't been modified to adapt to the new naming. > > - If you previously set DISTRO_FEATURES_BACKFILL_CONSIDERED, use the new > variable DISTRO_FEATURES_OPTED_OUT instead. > > - If you previously modified DISTRO_FEATURES_BACKFILL, don't do that. > > Signed-off-by: Paul Barker <paul@pbarker.dev> > --- Hi Paul, I believe this is failing in some cases: ERROR: libtasn1-4.21.0-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/tmp/work/x86-64-v3-poky-linux/libtasn1/4.21.0/temp/run.do_compile.3668072' failed with exit code 1 ... | gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\--path"; \ | if test "$?" = "0"; then \ | mkhtml_options="$mkhtml_options --path=\"/srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/tmp/work/x86-64-v3-poky-linux/libtasn1/4.21.0/build/../sources/libtasn1-4.21.0/doc/reference\""; \ | fi; \ | cd html && gtkdoc-mkhtml $mkhtml_options libtasn1 ../libtasn1-docs.xml | warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl" | compilation error: file /srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/tmp/work/x86-64-v3-poky-linux/libtasn1/4.21.0/recipe-sysroot-native/usr/share/gtk-doc/data/gtk-doc.xsl line 11 element import | xsl:import : unable to load http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl https://autobuilder.yoctoproject.org/valkyrie/#/builders/17/builds/3345 Can you have a look at the issue? Thanks, Mathieu
On Wed, 2026-04-01 at 16:40 +0200, Mathieu Dubois-Briand wrote: > On Tue Mar 31, 2026 at 9:29 PM CEST, Paul Barker wrote: > > Add default values to DISTRO_FEATURES using the new > > filter_default_features() function. > > > > This change obsoletes the variables DISTRO_FEATURES_BACKFILL and > > DISTRO_FEATURES_BACKFILL_CONSIDERED. Instead, all defaults are added via > > DISTRO_FEATURES_DEFAULTS and users can opt out of any of these using > > DISTRO_FEATURES_OPTED_OUT. Hopefully the variable naming here is easier > > for people to understand and remember. > > > > Migration notes: > > > > - If you have previously assigned DISTRO_FEATURES without using > > DISTRO_FEATURES_DEFAULT, you will now get the default features added > > automatically. You will need to review these and add any features you > > do not want to use to DISTRO_FEATURES_OPTED_OUT. > > > > - DISTRO_FEATURES_DEFAULT is now unused, the new variable name is > > slighlty different to ensure that it is not accidentally used if a > > layer hasn't been modified to adapt to the new naming. > > > > - If you previously set DISTRO_FEATURES_BACKFILL_CONSIDERED, use the new > > variable DISTRO_FEATURES_OPTED_OUT instead. > > > > - If you previously modified DISTRO_FEATURES_BACKFILL, don't do that. > > > > Signed-off-by: Paul Barker <paul@pbarker.dev> > > --- > > Hi Paul, > > I believe this is failing in some cases: > > ERROR: libtasn1-4.21.0-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/tmp/work/x86-64-v3-poky-linux/libtasn1/4.21.0/temp/run.do_compile.3668072' failed with exit code 1 > ... > > gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\--path"; \ > > if test "$?" = "0"; then \ > > mkhtml_options="$mkhtml_options --path=\"/srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/tmp/work/x86-64-v3-poky-linux/libtasn1/4.21.0/build/../sources/libtasn1-4.21.0/doc/reference\""; \ > > fi; \ > > cd html && gtkdoc-mkhtml $mkhtml_options libtasn1 ../libtasn1-docs.xml > > warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl" > > compilation error: file /srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/tmp/work/x86-64-v3-poky-linux/libtasn1/4.21.0/recipe-sysroot-native/usr/share/gtk-doc/data/gtk-doc.xsl line 11 element import > > xsl:import : unable to load http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl > > https://autobuilder.yoctoproject.org/valkyrie/#/builders/17/builds/3345 > > Can you have a look at the issue? Hi Mathieu, Thanks for the heads up. I saw some issues in an oe-selftest run after sending the patches, I have a fix for that. I'll run a qemux86-world-alt build to confirm I've also fixed the errors you saw. Best regards,
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 22b427a5211b..0a4cfd594c72 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass @@ -454,8 +454,11 @@ def set_packagetriplet(d): python () { import string, re + # Filter default features to allow users to opt out of features they don't + # want. + oe.utils.filter_default_features("DISTRO_FEATURES", d) + # Handle backfilling - oe.utils.features_backfill("DISTRO_FEATURES", d) oe.utils.features_backfill("MACHINE_FEATURES", d) # To add a recipe to the skip list , set: diff --git a/meta/classes-recipe/crosssdk.bbclass b/meta/classes-recipe/crosssdk.bbclass index a2853e6a9201..e987f1be05e9 100644 --- a/meta/classes-recipe/crosssdk.bbclass +++ b/meta/classes-recipe/crosssdk.bbclass @@ -16,13 +16,14 @@ PACKAGE_ARCH = "${SDK_ARCH}" python () { # set TUNE_PKGARCH to SDK_ARCH d.setVar('TUNE_PKGARCH', d.getVar('SDK_ARCH')) - # Set features here to prevent appends and distro features backfill - # from modifying nativesdk distro features + # Reset features here to prevent DISTRO_FEATURES modifications from + # affecting crosssdk distro features features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split()) - oe.utils.features_backfill("DISTRO_FEATURES", d) + d.setVar('DISTRO_FEATURES', '') + oe.utils.filter_default_features("DISTRO_FEATURES", d) filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split()) d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered))) - d.setVar("DISTRO_FEATURES_BACKFILL", "") + d.setVar("DISTRO_FEATURES_DEFAULTS", "") } STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}" diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass index 5aa9c8e4145e..47a9a066a1a8 100644 --- a/meta/classes-recipe/native.bbclass +++ b/meta/classes-recipe/native.bbclass @@ -126,13 +126,14 @@ python native_virtclass_handler () { return bpn = d.getVar("BPN") - # Set features here to prevent appends and distro features backfill - # from modifying native distro features + # Reset features here to prevent DISTRO_FEATURES modifications from + # affecting native distro features features = set(d.getVar("DISTRO_FEATURES_NATIVE").split()) - oe.utils.features_backfill("DISTRO_FEATURES", d) + d.setVar('DISTRO_FEATURES', '') + oe.utils.filter_default_features("DISTRO_FEATURES", d) filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split()) d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered))) - d.setVar("DISTRO_FEATURES_BACKFILL", "") + d.setVar("DISTRO_FEATURES_DEFAULTS", "") classextend = d.getVar('BBCLASSEXTEND') or "" if "native" not in classextend: diff --git a/meta/classes-recipe/nativesdk.bbclass b/meta/classes-recipe/nativesdk.bbclass index 5adb7515bf14..f663067f3a25 100644 --- a/meta/classes-recipe/nativesdk.bbclass +++ b/meta/classes-recipe/nativesdk.bbclass @@ -78,13 +78,14 @@ python nativesdk_virtclass_handler () { if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")): return - # Set features here to prevent appends and distro features backfill - # from modifying nativesdk distro features + # Reset features here to prevent DISTRO_FEATURES modifications from + # affecting nativesdk distro features features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split()) - oe.utils.features_backfill("DISTRO_FEATURES", d) + d.setVar('DISTRO_FEATURES', '') + oe.utils.filter_default_features("DISTRO_FEATURES", d) filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split()) d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered))) - d.setVar("DISTRO_FEATURES_BACKFILL", "") + d.setVar("DISTRO_FEATURES_DEFAULTS", "") e.data.setVar("MLPREFIX", "nativesdk-") e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN").replace("-nativesdk", "").replace("nativesdk-", "")) diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 6b3443695a04..f851e2adc9f7 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -912,7 +912,6 @@ DISTRO_FEATURES_NATIVESDK:mingw32 = "x11 ipv6" DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation debuginfod opencl opengl wayland" DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation debuginfod opencl opengl wayland" -DISTRO_FEATURES_BACKFILL = "pulseaudio gobject-introspection-data ldconfig opengl ptest multiarch wayland vulkan" MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode" COMBINED_FEATURES = "${@oe.utils.set_intersect('DISTRO_FEATURES', 'MACHINE_FEATURES', d)}" diff --git a/meta/conf/distro/include/default-distrovars.inc b/meta/conf/distro/include/default-distrovars.inc index 7adcdfad4ff4..daa4d2a74dda 100644 --- a/meta/conf/distro/include/default-distrovars.inc +++ b/meta/conf/distro/include/default-distrovars.inc @@ -14,19 +14,22 @@ LOCALE_UTF8_IS_DEFAULT ?= "1" LOCALE_UTF8_IS_DEFAULT:class-nativesdk = "0" # seccomp is not yet ported to rv32 -DISTRO_FEATURES_DEFAULT:remove:riscv32 = "seccomp" +DISTRO_FEATURES_OPTED_OUT:append:riscv32 = "seccomp" # seccomp is not yet ported to ARC -DISTRO_FEATURES_DEFAULT:remove:arc = "seccomp" +DISTRO_FEATURES_OPTED_OUT:append:arc = "seccomp" # seccomp is not yet ported to microblaze -DISTRO_FEATURES_DEFAULT:remove:microblaze = "seccomp" +DISTRO_FEATURES_OPTED_OUT:append:microblaze = "seccomp" # seccomp is not yet ported to loongarch64 -DISTRO_FEATURES_DEFAULT:remove:loongarch64 = "seccomp" +DISTRO_FEATURES_OPTED_OUT:append:loongarch64 = "seccomp" -DISTRO_FEATURES_DEFAULT ?= "acl alsa bluetooth debuginfod ext2 ipv4 ipv6 pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11 vfat seccomp" -DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT}" +DISTRO_FEATURES_DEFAULTS ?= " \ + acl alsa bluetooth debuginfod ext2 ipv4 ipv6 pcmcia usbgadget usbhost \ + wifi xattr nfs zeroconf pci 3g nfc x11 vfat seccomp pulseaudio \ + gobject-introspection-data ldconfig opengl ptest multiarch wayland vulkan \ + " IMAGE_FEATURES ?= "" COMMERCIAL_AUDIO_PLUGINS ?= "" diff --git a/meta/conf/distro/include/tclibc-musl.inc b/meta/conf/distro/include/tclibc-musl.inc index 98d7a801ac84..a61a6ced0dd2 100644 --- a/meta/conf/distro/include/tclibc-musl.inc +++ b/meta/conf/distro/include/tclibc-musl.inc @@ -14,7 +14,7 @@ PREFERRED_PROVIDER_virtual/libc-locale ?= "musl-locales" PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-glibc" PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-glibc" -DISTRO_FEATURES_BACKFILL_CONSIDERED += "ldconfig" +DISTRO_FEATURES_OPTED_OUT += "ldconfig" #USE_NLS ?= "no" diff --git a/meta/conf/distro/include/tclibc-newlib.inc b/meta/conf/distro/include/tclibc-newlib.inc index 34318b24549c..fff9b9f066fb 100644 --- a/meta/conf/distro/include/tclibc-newlib.inc +++ b/meta/conf/distro/include/tclibc-newlib.inc @@ -11,7 +11,7 @@ PREFERRED_PROVIDER_virtual/libintl ?= "newlib" PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-glibc" PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-glibc" -DISTRO_FEATURES_BACKFILL_CONSIDERED += "ldconfig" +DISTRO_FEATURES_OPTED_OUT += "ldconfig" #USE_NLS ?= "no" diff --git a/meta/conf/distro/include/tclibc-picolibc.inc b/meta/conf/distro/include/tclibc-picolibc.inc index 2cd26cfd7dcd..6134b0d97d6a 100644 --- a/meta/conf/distro/include/tclibc-picolibc.inc +++ b/meta/conf/distro/include/tclibc-picolibc.inc @@ -11,7 +11,7 @@ PREFERRED_PROVIDER_virtual/libintl ?= "picolibc" PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-glibc" PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-glibc" -DISTRO_FEATURES_BACKFILL_CONSIDERED += "ldconfig" +DISTRO_FEATURES_OPTED_OUT += "ldconfig" IMAGE_LINGUAS = "" diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index 1853676fa060..5c93d0e47970 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -141,8 +141,8 @@ DISTRO[doc] = "The short name of the distribution. If the variable is blank, met DISTRO_EXTRA_RDEPENDS[doc] = "Specifies a list of distro-specific packages to add to all images. The variable only applies to the images that include packagegroup-base." DISTRO_EXTRA_RRECOMMENDS[doc] = "Specifies a list of distro-specific packages to add to all images if the packages exist. The list of packages are automatically installed but you can remove them." DISTRO_FEATURES[doc] = "The features enabled for the distribution." -DISTRO_FEATURES_BACKFILL[doc] = "Features to be added to DISTRO_FEATURES if not also present in DISTRO_FEATURES_BACKFILL_CONSIDERED. This variable is set in the meta/conf/bitbake.conf file and it is not intended to be user-configurable." -DISTRO_FEATURES_BACKFILL_CONSIDERED[doc] = "Features from DISTRO_FEATURES_BACKFILL that should not be backfilled (i.e. added to DISTRO_FEATURES) during the build." +DISTRO_FEATURES_DEFAULTS[doc] = "The default set of distribution features, prior to any filtering. Usually you should leave this alone and modify DISTRO_FEATURES and/or DISTRO_FEATURES_OPTED_OUT." +DISTRO_FEATURES_OPTED_OUT[doc] = "The set of default distribtion features to disable. Prefer opting out of features using this variable instead of using DISTRO_FEATURES:remove." DISTRO_NAME[doc] = "The long name of the distribution." DISTRO_PN_ALIAS[doc] = "Alias names used for the recipe in various Linux distributions." DISTRO_VERSION[doc] = "The version of the distribution."
Add default values to DISTRO_FEATURES using the new filter_default_features() function. This change obsoletes the variables DISTRO_FEATURES_BACKFILL and DISTRO_FEATURES_BACKFILL_CONSIDERED. Instead, all defaults are added via DISTRO_FEATURES_DEFAULTS and users can opt out of any of these using DISTRO_FEATURES_OPTED_OUT. Hopefully the variable naming here is easier for people to understand and remember. Migration notes: - If you have previously assigned DISTRO_FEATURES without using DISTRO_FEATURES_DEFAULT, you will now get the default features added automatically. You will need to review these and add any features you do not want to use to DISTRO_FEATURES_OPTED_OUT. - DISTRO_FEATURES_DEFAULT is now unused, the new variable name is slighlty different to ensure that it is not accidentally used if a layer hasn't been modified to adapt to the new naming. - If you previously set DISTRO_FEATURES_BACKFILL_CONSIDERED, use the new variable DISTRO_FEATURES_OPTED_OUT instead. - If you previously modified DISTRO_FEATURES_BACKFILL, don't do that. Signed-off-by: Paul Barker <paul@pbarker.dev> --- meta/classes-global/base.bbclass | 5 ++++- meta/classes-recipe/crosssdk.bbclass | 9 +++++---- meta/classes-recipe/native.bbclass | 9 +++++---- meta/classes-recipe/nativesdk.bbclass | 9 +++++---- meta/conf/bitbake.conf | 1 - meta/conf/distro/include/default-distrovars.inc | 15 +++++++++------ meta/conf/distro/include/tclibc-musl.inc | 2 +- meta/conf/distro/include/tclibc-newlib.inc | 2 +- meta/conf/distro/include/tclibc-picolibc.inc | 2 +- meta/conf/documentation.conf | 4 ++-- 10 files changed, 33 insertions(+), 25 deletions(-)