Fix invalid conditional appends
PATCH 1/1 Fix invalid conditional appends
Using A:class-target += " b" actually appends to A:class-target, which will later override A. Most likely what was originally intended is conditional append to A.
---
This patch (or patches if it turns out I should split it) fixes several findings for variable assignments of form:
A:someoverride += "foo"
and transforms them into:
A:append:someoverride = " foo"
In most of those cases I assume the original intent was to have a conditional append, but what was actually happening was append to a conditional override.
I first noticed such problem in our internal recipes and bbappends, but then I decided to check if similar issue exists upstream and turns out it does.
Here are results from bitbake-getvar for libffi.
Before patch:
$ grep EXTRA_OECONF /path/to/layers/openembedded-core/meta/recipes-support/libffi/libffi_3.5.2.bb
EXTRA_OECONF += "--disable-builddir --disable-exec-static-tramp"
EXTRA_OECONF:class-native += "--with-gcc-arch=generic"
$ bitbake-getvar -r libffi-native EXTRA_OECONF
#
# $EXTRA_OECONF [6 operations]
# set /path/to/layers/openembedded-core/meta/conf/bitbake.conf:590
# ""
# :append /path/to/layers/openembedded-core/meta/conf/distro/include/no-static-libs.inc:24
# "${DISABLE_STATIC}"
# set /path/to/layers/openembedded-core/meta/conf/documentation.conf:164
# [doc] "Additional configure script options."
# append /path/to/layers/openembedded-core/meta/recipes-support/libffi/libffi_3.5.2.bb:18
# "--disable-builddir --disable-exec-static-tramp"
# :append /path/to/layers/openembedded-core/meta/classes-recipe/autotools.bbclass:134
# " ${PACKAGECONFIG_CONFARGS}"
# override[class-native]:append /path/to/layers/openembedded-core/meta/recipes-support/libffi/libffi_3.5.2.bb:19
# "--with-gcc-arch=generic"
# pre-expansion value:
# " --with-gcc-arch=generic${DISABLE_STATIC} ${PACKAGECONFIG_CONFARGS}"
EXTRA_OECONF=" --with-gcc-arch=generic --disable-static "After patch:
$ grep EXTRA_OECONF /path/to/layers/openembedded-core/meta/recipes-support/libffi/libffi_3.5.2.bb
EXTRA_OECONF += "--disable-builddir --disable-exec-static-tramp"
EXTRA_OECONF:append:class-native = " --with-gcc-arch=generic"
$ bitbake-getvar -r libffi-native EXTRA_OECONF#
# $EXTRA_OECONF [6 operations]
# set /path/to/layers/openembedded-core/meta/conf/bitbake.conf:590
# ""
# :append /path/to/layers/openembedded-core/meta/conf/distro/include/no-static-libs.inc:24
# "${DISABLE_STATIC}"
# set /path/to/layers/openembedded-core/meta/conf/documentation.conf:164
# [doc] "Additional configure script options."
# append /path/to/layers/openembedded-core/meta/recipes-support/libffi/libffi_3.5.2.bb:18
# "--disable-builddir --disable-exec-static-tramp"
# :append[class-native] /path/to/layers/openembedded-core/meta/recipes-support/libffi/libffi_3.5.2.bb:19
# " --with-gcc-arch=generic"
# :append /path/to/layers/openembedded-core/meta/classes-recipe/autotools.bbclass:134
# " ${PACKAGECONFIG_CONFARGS}"
# pre-expansion value:
# " --disable-builddir --disable-exec-static-tramp${DISABLE_STATIC} --with-gcc-arch=generic ${PACKAGECONFIG_CONFARGS}"
EXTRA_OECONF=" --disable-builddir --disable-exec-static-tramp --disable-static --with-gcc-arch=generic "Now there are some cases where I am not sure if the override was needed in the first place. Actually most :class-target overrides seem unnecessary. Please let me know if I should actually delete the override and keep += for them.
--- meta/recipes-devtools/bootchart2/bootchart2_0.14.9.bb | 4 ++-- meta/recipes-devtools/dnf/dnf_4.24.0.bb | 2 +- meta/recipes-devtools/python/python3-asn1crypto_1.5.1.bb | 2 +- meta/recipes-devtools/python/python3-bcrypt_5.0.0.bb | 2 +- meta/recipes-devtools/python/python3-chardet_5.2.0.bb | 2 +- meta/recipes-devtools/python/python3-cython_3.2.4.bb | 4 ++-- meta/recipes-devtools/python/python3-ply_3.11.bb | 2 +- meta/recipes-devtools/python/python3-pyasn1_0.6.2.bb | 2 +- meta/recipes-devtools/python/python3-pycparser_3.0.bb | 4 ++-- meta/recipes-devtools/python/python3-pysocks_1.7.1.bb | 2 +- meta/recipes-devtools/python/python3-pytz_2025.2.bb | 2 +- meta/recipes-devtools/qemu/qemu_10.2.0.bb | 2 +- meta/recipes-kernel/systemtap/systemtap_5.4.bb | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-)
meta/recipes-devtools/bootchart2/bootchart2_0.14.9.bb +2 -2
@@ -150,8 +150,8 @@ do_install () { PACKAGES =+ "pybootchartgui" FILES:pybootchartgui += "${PYTHON_SITEPACKAGES_DIR}/pybootchartgui ${bindir}/pybootchartgui" RDEPENDS:pybootchartgui = "python3-pycairo python3-compression python3-image python3-math python3-shell python3-compression python3-codecs" -RDEPENDS:${PN}:class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit-pidof', 'procps', d)}" -RDEPENDS:${PN}:class-target += "lsb-release" +RDEPENDS:${PN}:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit-pidof', 'procps', d)}" +RDEPENDS:${PN}:append:class-target = " lsb-release" DEPENDS:append:class-native = " python3-pycairo-native" PACKAGES =+ "bootchartd-stop-initscript"
meta/recipes-devtools/dnf/dnf_4.24.0.bb +1 -1
@@ -55,7 +55,7 @@ RDEPENDS:${PN} += " \ RDEPENDS:${PN}:class-native = "" -RRECOMMENDS:${PN}:class-target += "gnupg" +RRECOMMENDS:${PN}:append:class-target = " gnupg" # Create a symlink called 'dnf' as 'make install' does not do it, but # .spec file in dnf source tree does (and then Fedora and dnf documentation
meta/recipes-devtools/python/python3-asn1crypto_1.5.1.bb +1 -1
@@ -10,7 +10,7 @@ SRC_URI[sha256sum] = "13ae38502be632115abf8a24cbe5f4da52e3b5231990aff31123c80530 inherit pypi setuptools3 -RDEPENDS:${PN}:class-target += " \ +RDEPENDS:${PN}:append:class-target = " \ python3-codecs \ python3-crypt \ python3-ctypes \
meta/recipes-devtools/python/python3-bcrypt_5.0.0.bb +1 -1
@@ -14,7 +14,7 @@ CARGO_SRC_DIR = "src/_bcrypt" require ${BPN}-crates.inc -RDEPENDS:${PN}:class-target += "\ +RDEPENDS:${PN}:append:class-target = " \ python3-cffi \ python3-ctypes \ python3-shell \
meta/recipes-devtools/python/python3-chardet_5.2.0.bb +1 -1
@@ -14,7 +14,7 @@ FILES:${PN}-cli += " \ RDEPENDS:${PN}-cli = "${PN} " -RDEPENDS:${PN}:class-target += " \ +RDEPENDS:${PN}:append:class-target = " \ python3-logging \ "
meta/recipes-devtools/python/python3-cython_3.2.4.bb +2 -2
@@ -25,7 +25,7 @@ do_install:append() { mv ${D}${bindir}/cygdb ${D}${bindir}/cygdb3 } -RDEPENDS:${PN}:class-target += "\ +RDEPENDS:${PN}:append:class-target = " \ python3-misc \ python3-netserver \ python3-pkgutil \
@@ -35,7 +35,7 @@ RDEPENDS:${PN}:class-target += "\ python3-xml \ " -RDEPENDS:${PN}:class-nativesdk += "\ +RDEPENDS:${PN}:append:class-nativesdk = " \ nativesdk-python3-misc \ nativesdk-python3-netserver \ nativesdk-python3-pkgutil \
meta/recipes-devtools/python/python3-ply_3.11.bb +1 -1
@@ -9,7 +9,7 @@ SRC_URI[sha256sum] = "00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446 inherit pypi setuptools3 -RDEPENDS:${PN}:class-target += "\ +RDEPENDS:${PN}:append:class-target = " \ python3-netclient \ python3-shell \ "
meta/recipes-devtools/python/python3-pyasn1_0.6.2.bb +1 -1
@@ -7,7 +7,7 @@ SRC_URI[sha256sum] = "9b59a2b25ba7e4f8197db7686c09fb33e658b98339fadb826e95126290 inherit pypi python_setuptools_build_meta ptest-python-pytest -RDEPENDS:${PN}:class-target += " \ +RDEPENDS:${PN}:append:class-target = " \ python3-codecs \ python3-logging \ python3-math \
meta/recipes-devtools/python/python3-pycparser_3.0.bb +2 -2
@@ -9,11 +9,11 @@ inherit pypi python_setuptools_build_meta BBCLASSEXTEND = "native nativesdk" -RDEPENDS:${PN}:class-target += "\ +RDEPENDS:${PN}:append:class-target = " \ python3-netclient \ " -RSUGGESTS:${PN}:class-target += "\ +RSUGGESTS:${PN}:append:class-target = " \ cpp \ cpp-symlinks \ "
meta/recipes-devtools/python/python3-pysocks_1.7.1.bb +1 -1
@@ -10,7 +10,7 @@ UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}" inherit pypi setuptools3 -RDEPENDS:${PN}:class-target += "\ +RDEPENDS:${PN}:append:class-target = " \ python3-email \ python3-io \ python3-logging \
meta/recipes-devtools/python/python3-pytz_2025.2.bb +1 -1
@@ -9,7 +9,7 @@ PTEST_PYTEST_DIR = "pytz/tests" SRC_URI[sha256sum] = "360b9e3dbb49a209c21ad61809c7fb453643e048b38924c765813546746e81c3" -RDEPENDS:${PN}:class-target += "\ +RDEPENDS:${PN}:append:class-target = " \ python3-datetime \ python3-doctest \ python3-io \
meta/recipes-devtools/qemu/qemu_10.2.0.bb +1 -1
@@ -9,7 +9,7 @@ DEPENDS:append:libc-musl = " libucontext" CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" LDFLAGS:append:toolchain-clang:x86 = " -latomic" -RDEPENDS:${PN}-common:class-target += "bash" +RDEPENDS:${PN}-common:append:class-target = " bash" EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}"
meta/recipes-kernel/systemtap/systemtap_5.4.bb +1 -1
@@ -52,7 +52,7 @@ FILES:${PN}-runtime = "\ ${bindir}/stapsh \ ${libexecdir}/${BPN}/stapio \ " -RDEPENDS:${PN}:class-target += "${PN}-runtime" +RDEPENDS:${PN}:append:class-target = " ${PN}-runtime" PACKAGES =+ "${PN}-examples" FILES:${PN}-examples = "${datadir}/${BPN}/examples/"
---
base-commit: c05ef14f2840e9c0cb9fc7a5bf52cbfa9ccedc1a
change-id: 20260314-fix-invalid-appends-cf5197ef2f07
Best regards,
Signature · 1 line
Michal Sieron <[email protected]>
Patchtest results for [PATCH] Fix invalid conditional appends
Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:
---
Testing patch /home/patchtest/share/mboxes/Fix-invalid-conditional-appends.patch
FAIL: test shortlog format: Commit shortlog (first line of commit message) should follow the format "<target>: <summary>" (test_mbox.TestMbox.test_shortlog_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)
SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
---
Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!