sanity.conf: Depend on bitbake 2.18
PATCH 1/2 sanity.conf: Depend on bitbake 2.18
In readiness for release and due to the distro_features fix which needs bb.utils.filter_string(), update to depend on bitbake 2.18.0
--- meta/conf/sanity.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/sanity.conf +1 -1
@@ -3,7 +3,7 @@ # See sanity.bbclass # # Expert users can confirm their sanity with "touch conf/sanity.conf" -BB_MIN_VERSION = "2.15.2" +BB_MIN_VERSION = "2.18.0" SANITY_ABIFILE = "${TMPDIR}/abi_version"
PATCH 2/2 base/bitbake.conf: Rework DISTRO_FEATURES and MACHINE_FEATURES default handling
The existing code for handling defaults in distro/machine features triggers from anonymous python in base.bbclass.
Anonymous python is executed after all inherits including deferred inherits are processed. This means conditional inherits can't use DISTRO_FEATURES or MACHINE_FEATURES which is contra to user expectations. This leads to a hard to understand failure mode.
Whilst it isn't as performant, we can handle the features using inline python function calls. This patch switches to execute the code that way.
These changes depend on a new function in bb.utils (filter_string). filter_default_features is changed to return a string rather than set it and the tests for it are updated to match.
--- 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 | 4 ++-- meta/lib/oe/utils.py | 7 ++++++- meta/lib/oeqa/selftest/cases/oelib/utils.py | 16 ++++++++-------- 7 files changed, 22 insertions(+), 37 deletions(-)
meta/classes-global/base.bbclass +0 -5
@@ -454,11 +454,6 @@ 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) - oe.utils.filter_default_features("MACHINE_FEATURES", d) - # To add a recipe to the skip list , set: # SKIP_RECIPE[pn] = "message" pn = d.getVar('PN')
meta/classes-recipe/crosssdk.bbclass +2 -7
@@ -16,13 +16,8 @@ PACKAGE_ARCH = "${SDK_ARCH}" python () { # set TUNE_PKGARCH to SDK_ARCH d.setVar('TUNE_PKGARCH', d.getVar('SDK_ARCH')) - # Set features here to prevent DISTRO_FEATURES modifications from affecting - # crosssdk distro features - features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split()) - 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_DEFAULTS", "") + defaults = d.getVar("DISTRO_FEATURES") + d.setVar("DISTRO_FEATURES", '${@oe.utils.class_filter_features("' + defaults + '", "DISTRO_FEATURES_NATIVESDK", "DISTRO_FEATURES_FILTER_NATIVESDK", d)}') } STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
meta/classes-recipe/native.bbclass +2 -7
@@ -126,13 +126,8 @@ python native_virtclass_handler () { return bpn = d.getVar("BPN") - # Set features here to prevent DISTRO_FEATURES modifications from affecting - # native distro features - features = set(d.getVar("DISTRO_FEATURES_NATIVE").split()) - 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_DEFAULTS", "") + defaults = d.getVar("DISTRO_FEATURES") + d.setVar("DISTRO_FEATURES", '${@oe.utils.class_filter_features("' + defaults + '", "DISTRO_FEATURES_NATIVE", "DISTRO_FEATURES_FILTER_NATIVE", d)}') classextend = d.getVar('BBCLASSEXTEND') or "" if "native" not in classextend:
meta/classes-recipe/nativesdk.bbclass +2 -7
@@ -77,13 +77,8 @@ python nativesdk_virtclass_handler () { if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")): return - # Set features here to prevent DISTRO_FEATURES modifications from affecting - # nativesdk distro features - features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split()) - 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_DEFAULTS", "") + defaults = d.getVar("DISTRO_FEATURES") + d.setVar("DISTRO_FEATURES", '${@oe.utils.class_filter_features("' + defaults + '", "DISTRO_FEATURES_NATIVESDK", "DISTRO_FEATURES_FILTER_NATIVESDK", d)}') e.data.setVar("MLPREFIX", "nativesdk-") e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN").replace("-nativesdk", "").replace("nativesdk-", ""))
meta/conf/bitbake.conf +2 -2
@@ -893,10 +893,10 @@ OES_BITBAKE_CONF = "1" # Machine properties and packagegroup-base stuff ################################################################## -MACHINE_FEATURES ?= "" +MACHINE_FEATURES:append = " ${@oe.utils.filter_default_features('MACHINE_FEATURES', d)}" SDK_MACHINE_FEATURES ?= "" -DISTRO_FEATURES ?= "" +DISTRO_FEATURES:append = " ${@oe.utils.filter_default_features('DISTRO_FEATURES', d)}" DISTRO_EXTRA_RDEPENDS ?= "" DISTRO_EXTRA_RRECOMMENDS ?= ""
meta/lib/oe/utils.py +6 -1
@@ -154,7 +154,12 @@ def filter_default_features(varname, d): default_features = set_difference(varname + "_DEFAULTS", varname + "_OPTED_OUT", d) - d.appendVar(varname, " " + default_features) + return default_features + +def class_filter_features(defaults, features_var, filter_var, d): + features = set(d.getVar(features_var).split()) + filtered = set(bb.utils.filter_string(defaults, d.getVar(filter_var)).split()) + return " ".join(sorted(features | filtered)) def all_distro_features(d, features, truevalue="1", falsevalue=""): """
meta/lib/oeqa/selftest/cases/oelib/utils.py +8 -8
@@ -115,26 +115,26 @@ class TestDefaultFeatures(TestCase): # Test with nothing opted out d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "alpha beta gamma") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "alpha beta gamma") # opt out of a single feature d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") d.setVar("DISTRO_FEATURES_OPTED_OUT", "beta") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "alpha gamma") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "alpha gamma") # opt out of everything d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") d.setVar("DISTRO_FEATURES_OPTED_OUT", "gamma alpha beta") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "") # opt out of something that isn't in our defaults d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") d.setVar("DISTRO_FEATURES_OPTED_OUT", "omega") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "alpha beta gamma") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "alpha beta gamma")
Re: [OE-core] [PATCH 2/2] base/bitbake.conf: Rework DISTRO_FEATURES and MACHINE_FEATURES default handling
Hi,
I found via git bisect that this breaks my builds.
It breaks two things:
1.
With DISTRO_FEATURES containing seccomp (e.g. when using meta-virtualization and/or meta-security), this libseccomp-native is not found by gnutls-native anymore. Sure enough, the libseccomp recipe does not have BBCLASSEXTEND = "native nativesdk" like gnutls has. So this change has at least some good points to point out pre-existing issues.
2.
A circular dependency occurs:
ERROR: Task virtual:native:/mnt2/zozo/yocto-6.0-arm/conf/../layers/openembedded-core/meta/recipes-core/util-linux/util-linux_2.41.3.bb:do_create_recipe_spdx has circular dependency on /mnt2/zozo/yocto-6.0-arm/conf/../layers/openembedded-core/meta/recipes-core/systemd/systemd-systemctl-native_259.5.bb:do_create_recipe_spdx
ERROR: Command execution failed: Exited with 1
Adding INHERIT += "nospdx" does not fix this and none of the layers have any bbappend that would explain this.
Using the preceding commit fixes the build even without adding the necessary BBCLASSEXTEND incantation to libseccomp.
2026. 04. 23. 15:33 keltezéssel, Richard Purdie via lists.openembedded.org írta:
Quoted 185 lines
The existing code for handling defaults in distro/machine features triggers from anonymous python in base.bbclass.
Anonymous python is executed after all inherits including deferred inherits are processed. This means conditional inherits can't use
DISTRO_FEATURESorMACHINE_FEATURESwhich is contra to user expectations. This leads to a hard to understand failure mode.Whilst it isn't as performant, we can handle the features using inline python function calls. This patch switches to execute the code that way.
These changes depend on a new function in bb.utils (
filter_string).filter_default_featuresis changed to return a string rather than set it and the tests for it are updated to match.Signed-off-by Richard Purdie <[email protected]>--- 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 | 4 ++-- meta/lib/oe/utils.py | 7 ++++++- meta/lib/oeqa/selftest/cases/oelib/utils.py | 16 ++++++++-------- 7 files changed, 22 insertions(+), 37 deletions(-)meta/classes-global/base.bbclass +0
-5@@ -454,11 +454,6 @@ 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) - oe.utils.filter_default_features("MACHINE_FEATURES", d) - # To add a recipe to the skip list , set: # SKIP_RECIPE[pn] = "message" pn = d.getVar('PN')meta/classes-recipe/crosssdk.bbclass +2
-7@@ -16,13 +16,8 @@ PACKAGE_ARCH = "${SDK_ARCH}" python () { # set TUNE_PKGARCH to SDK_ARCH d.setVar('TUNE_PKGARCH', d.getVar('SDK_ARCH')) - # Set features here to prevent DISTRO_FEATURES modifications from affecting - # crosssdk distro features - features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split()) - 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_DEFAULTS", "") + defaults = d.getVar("DISTRO_FEATURES") + d.setVar("DISTRO_FEATURES", '${@oe.utils.class_filter_features("' + defaults + '", "DISTRO_FEATURES_NATIVESDK", "DISTRO_FEATURES_FILTER_NATIVESDK", d)}') } STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"meta/classes-recipe/native.bbclass +2
-7@@ -126,13 +126,8 @@ python native_virtclass_handler () { return bpn = d.getVar("BPN") - # Set features here to prevent DISTRO_FEATURES modifications from affecting - # native distro features - features = set(d.getVar("DISTRO_FEATURES_NATIVE").split()) - 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_DEFAULTS", "") + defaults = d.getVar("DISTRO_FEATURES") + d.setVar("DISTRO_FEATURES", '${@oe.utils.class_filter_features("' + defaults + '", "DISTRO_FEATURES_NATIVE", "DISTRO_FEATURES_FILTER_NATIVE", d)}') classextend = d.getVar('BBCLASSEXTEND') or "" if "native" not in classextend:meta/classes-recipe/nativesdk.bbclass +2
-7@@ -77,13 +77,8 @@ python nativesdk_virtclass_handler () { if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")): return - # Set features here to prevent DISTRO_FEATURES modifications from affecting - # nativesdk distro features - features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split()) - 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_DEFAULTS", "") + defaults = d.getVar("DISTRO_FEATURES") + d.setVar("DISTRO_FEATURES", '${@oe.utils.class_filter_features("' + defaults + '", "DISTRO_FEATURES_NATIVESDK", "DISTRO_FEATURES_FILTER_NATIVESDK", d)}') e.data.setVar("MLPREFIX", "nativesdk-") e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN").replace("-nativesdk", "").replace("nativesdk-", ""))meta/conf/bitbake.conf +2
-2@@ -893,10 +893,10 @@ OES_BITBAKE_CONF = "1" # Machine properties and packagegroup-base stuff ################################################################## -MACHINE_FEATURES ?= "" +MACHINE_FEATURES:append = " ${@oe.utils.filter_default_features('MACHINE_FEATURES', d)}" SDK_MACHINE_FEATURES ?= "" -DISTRO_FEATURES ?= "" +DISTRO_FEATURES:append = " ${@oe.utils.filter_default_features('DISTRO_FEATURES', d)}" DISTRO_EXTRA_RDEPENDS ?= "" DISTRO_EXTRA_RRECOMMENDS ?= ""meta/lib/oe/utils.py +6
-1@@ -154,7 +154,12 @@ def filter_default_features(varname, d): default_features = set_difference(varname + "_DEFAULTS", varname + "_OPTED_OUT", d) - d.appendVar(varname, " " + default_features) + return default_features + +def class_filter_features(defaults, features_var, filter_var, d): + features = set(d.getVar(features_var).split()) + filtered = set(bb.utils.filter_string(defaults, d.getVar(filter_var)).split()) + return " ".join(sorted(features | filtered)) def all_distro_features(d, features, truevalue="1", falsevalue=""): """meta/lib/oeqa/selftest/cases/oelib/utils.py +8
-9@@ -115,26 +115,26 @@ class TestDefaultFeatures(TestCase): # Test with nothing opted out d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "alpha beta gamma") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "alpha beta gamma") # opt out of a single feature d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") d.setVar("DISTRO_FEATURES_OPTED_OUT", "beta") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "alpha gamma") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "alpha gamma") # opt out of everything d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") d.setVar("DISTRO_FEATURES_OPTED_OUT", "gamma alpha beta") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "") # opt out of something that isn't in our defaults d.setVar("DISTRO_FEATURES", "") d.setVar("DISTRO_FEATURES_DEFAULTS", "alpha beta gamma") d.setVar("DISTRO_FEATURES_OPTED_OUT", "omega") - filter_default_features("DISTRO_FEATURES", d) - self.assertEqual(d.getVar("DISTRO_FEATURES").strip(), "alpha beta gamma") + filtered = filter_default_features("DISTRO_FEATURES", d) + self.assertEqual(filtered.strip(), "alpha beta gamma") -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#235771): https://lists.openembedded.org/g/openembedded-core/message/235771
Mute This Topic: https://lists.openembedded.org/mt/118971570/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH 2/2] base/bitbake.conf: Rework DISTRO_FEATURES and MACHINE_FEATURES default handling
Quoted 27 lines · Böszörményi Zoltán
I found via git bisect that this breaks my builds.
It breaks two things:
1.
With
DISTRO_FEATUREScontaining seccomp (e.g. when using meta-virtualization and/or meta-security), this libseccomp-native is not found by gnutls-native anymore. Sure enough, the libseccomp recipe does not have BBCLASSEXTEND = "native nativesdk" like gnutls has. So this change has at least some good points to point out pre-existing issues.2.
A circular dependency occurs:
ERROR: Task virtual:native:/mnt2/zozo/yocto-6.0-arm/conf/../layers/openembedded- core/meta/recipes-core/util-linux/util- linux_2.41.3.bb:do_create_recipe_spdx
has circular dependency on /mnt2/zozo/yocto-6.0-arm/conf/../layers/openembedded- core/meta/recipes-core/systemd/systemd-systemctl- native_259.5.bb:do_create_recipe_spdx
ERROR: Command execution failed: Exited with 1
Quoted 5 lines
Adding INHERIT += "nospdx" does not fix this and none of the layers have any bbappend that would explain this.
Using the preceding commit fixes the build even without adding the necessary BBCLASSEXTEND incantation to libseccomp.
I tried to reproduce this by including meta-virtualization, using a systemd based DISTRO (poky-altcfg), setting seccomp in my DISTRO_FEATURES and building both util-linux-native and systemd- systemctl-native (and then world). I wasn't able to reproduce.
How do I reproduce it?
Cheers,
Richard
Re: [OE-core] [PATCH 2/2] base/bitbake.conf: Rework DISTRO_FEATURES and MACHINE_FEATURES default handling
2026. 04. 27. 16:26 keltezéssel, Richard Purdie írta:
Quoted 31 lines · Böszörményi Zoltán
Quoted 30 lines
I found via git bisect that this breaks my builds.
It breaks two things:
1.
With
DISTRO_FEATUREScontaining seccomp (e.g. when using meta-virtualization and/or meta-security), this libseccomp-native is not found by gnutls-native anymore. Sure enough, the libseccomp recipe does not have BBCLASSEXTEND = "native nativesdk" like gnutls has. So this change has at least some good points to point out pre-existing issues.2.
A circular dependency occurs:
ERROR: Task virtual:native:/mnt2/zozo/yocto-6.0-arm/conf/../layers/openembedded- core/meta/recipes-core/util-linux/util- linux_2.41.3.bb:do_create_recipe_spdx
has circular dependency on /mnt2/zozo/yocto-6.0-arm/conf/../layers/openembedded- core/meta/recipes-core/systemd/systemd-systemctl- native_259.5.bb:do_create_recipe_spdx
ERROR: Command execution failed: Exited with 1Adding INHERIT += "nospdx" does not fix this and none of the layers have any bbappend that would explain this.
Quoted 8 lines
Quoted 2 lines
Using the preceding commit fixes the build even without adding the necessary BBCLASSEXTEND incantation to libseccomp.
I tried to reproduce this by including meta-virtualization, using a systemd based DISTRO (poky-altcfg), setting seccomp in my
DISTRO_FEATURESand building both util-linux-native and systemd- systemctl-native (and then world). I wasn't able to reproduce.How do I reproduce it?
I only found the culprit today.
I had this lingering in my custom distro layer:
DISTRO_FEATURES += "${DISTRO_FEATURES_LIBC}"
Apparently, DISTRO_FEATURES_LIBC was dropped in 2019 without me noticing it and nothing was warning about that I was still using it.
The circular dependency problem was gone after removing this line.
Please, add this variable to the list of obsolete variables.
Thanks!