* [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency @ 2025-04-10 4:08 Qi.Chen 2025-04-10 4:08 ` [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions Qi.Chen 2025-04-10 6:15 ` [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency Richard Purdie 0 siblings, 2 replies; 9+ messages in thread From: Qi.Chen @ 2025-04-10 4:08 UTC (permalink / raw) To: openembedded-core From: Chen Qi <Qi.Chen@windriver.com> Some classes/recipes inherit qemu.bbclass but does not actually use anything from it. Besides, putting qemu-native in PACKAGE_WRITE_DEPS is not needed because the process of generating package does not need qemu-native. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> --- meta/classes-recipe/fontcache.bbclass | 3 --- meta/classes-recipe/gio-module-cache.bbclass | 3 --- meta/classes-recipe/gtk-immodules-cache.bbclass | 4 ---- meta/classes-recipe/manpages.bbclass | 2 -- meta/classes-recipe/pixbufcache.bbclass | 5 +---- meta/recipes-core/systemd/systemd_257.4.bb | 3 +-- meta/recipes-core/udev/eudev_3.2.14.bb | 2 +- 7 files changed, 3 insertions(+), 19 deletions(-) diff --git a/meta/classes-recipe/fontcache.bbclass b/meta/classes-recipe/fontcache.bbclass index 6f4978369d..6082af08f3 100644 --- a/meta/classes-recipe/fontcache.bbclass +++ b/meta/classes-recipe/fontcache.bbclass @@ -9,9 +9,6 @@ # packages. # -PACKAGE_WRITE_DEPS += "qemu-native" -inherit qemu - FONT_PACKAGES ??= "${PN}" FONT_PACKAGES:class-native = "" FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils" diff --git a/meta/classes-recipe/gio-module-cache.bbclass b/meta/classes-recipe/gio-module-cache.bbclass index d12e03c4a0..4340715b01 100644 --- a/meta/classes-recipe/gio-module-cache.bbclass +++ b/meta/classes-recipe/gio-module-cache.bbclass @@ -4,9 +4,6 @@ # SPDX-License-Identifier: MIT # -PACKAGE_WRITE_DEPS += "qemu-native" -inherit qemu - GIO_MODULE_PACKAGES ??= "${PN}" gio_module_cache_common() { diff --git a/meta/classes-recipe/gtk-immodules-cache.bbclass b/meta/classes-recipe/gtk-immodules-cache.bbclass index 8fbe1dd1fb..83deb2d48a 100644 --- a/meta/classes-recipe/gtk-immodules-cache.bbclass +++ b/meta/classes-recipe/gtk-immodules-cache.bbclass @@ -8,10 +8,6 @@ # # Usage: Set GTKIMMODULES_PACKAGES to the packages that needs to update the inputmethod modules -PACKAGE_WRITE_DEPS += "qemu-native" - -inherit qemu - GTKIMMODULES_PACKAGES ?= "${PN}" gtk_immodule_cache_postinst() { diff --git a/meta/classes-recipe/manpages.bbclass b/meta/classes-recipe/manpages.bbclass index e9ca2f895b..bdd91b8564 100644 --- a/meta/classes-recipe/manpages.bbclass +++ b/meta/classes-recipe/manpages.bbclass @@ -10,8 +10,6 @@ # by default. PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}" -inherit qemu - # usually manual files are packaged to ${PN}-doc except man-pages MAN_PKG ?= "${PN}-doc" diff --git a/meta/classes-recipe/pixbufcache.bbclass b/meta/classes-recipe/pixbufcache.bbclass index 107e38885e..66ac4ed23c 100644 --- a/meta/classes-recipe/pixbufcache.bbclass +++ b/meta/classes-recipe/pixbufcache.bbclass @@ -9,12 +9,9 @@ # packages. # -DEPENDS:append:class-target = " qemu-native" -inherit qemu - PIXBUF_PACKAGES ??= "${PN}" -PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native" +PACKAGE_WRITE_DEPS += "gdk-pixbuf-native" pixbufcache_common() { if [ "x$D" != "x" ]; then diff --git a/meta/recipes-core/systemd/systemd_257.4.bb b/meta/recipes-core/systemd/systemd_257.4.bb index 24aad11c0a..4066509f7d 100644 --- a/meta/recipes-core/systemd/systemd_257.4.bb +++ b/meta/recipes-core/systemd/systemd_257.4.bb @@ -8,7 +8,7 @@ DEPENDS = "gperf-native libcap util-linux python3-jinja2-native" SECTION = "base/shell" -inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check mime +inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives systemd gettext bash-completion manpages features_check mime # unmerged-usr support is deprecated upstream, taints the system and will be # removed in the near future. Fail the build if it is not enabled. @@ -932,7 +932,6 @@ pkg_prerm:${PN}:libc-glibc () { fi } -PACKAGE_WRITE_DEPS += "qemu-native" pkg_postinst:udev-hwdb () { if test -n "$D"; then $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \ diff --git a/meta/recipes-core/udev/eudev_3.2.14.bb b/meta/recipes-core/udev/eudev_3.2.14.bb index b3e7d092c5..24551a3fc5 100644 --- a/meta/recipes-core/udev/eudev_3.2.14.bb +++ b/meta/recipes-core/udev/eudev_3.2.14.bb @@ -20,7 +20,7 @@ SRC_URI[sha256sum] = "8da4319102f24abbf7fff5ce9c416af848df163b29590e666d334cc192 GITHUB_BASE_URI = "https://github.com/eudev-project/eudev/releases" -inherit autotools update-rc.d qemu pkgconfig features_check manpages github-releases +inherit autotools update-rc.d pkgconfig features_check manpages github-releases CONFLICT_DISTRO_FEATURES = "systemd" -- 2.49.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions 2025-04-10 4:08 [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency Qi.Chen @ 2025-04-10 4:08 ` Qi.Chen 2025-04-10 7:50 ` Alexander Kanavin 2025-04-10 6:15 ` [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency Richard Purdie 1 sibling, 1 reply; 9+ messages in thread From: Qi.Chen @ 2025-04-10 4:08 UTC (permalink / raw) To: openembedded-core From: Chen Qi <Qi.Chen@windriver.com> Move the functions in qemu.bbclass to meta/lib/oe/qemu.py as they are generally useful. Add a deprecation notice in qemu.bbclass so that we can remove it in the future. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> --- meta/classes-recipe/allarch.bbclass | 2 - meta/classes-recipe/cmake-qemu.bbclass | 4 +- meta/classes-recipe/gtk-doc.bbclass | 4 +- meta/classes-recipe/libc-package.bbclass | 4 +- meta/classes-recipe/meson.bbclass | 4 +- meta/classes-recipe/qemu.bbclass | 57 +++---------------- meta/conf/bitbake.conf | 9 +++ meta/lib/oe/__init__.py | 2 +- meta/lib/oe/qemu.py | 54 ++++++++++++++++++ .../glibc/glibc-testsuite_2.41.bb | 4 +- meta/recipes-devtools/gcc/gcc-testsuite.inc | 4 +- .../recipes-devtools/python/python3_3.13.2.bb | 4 +- .../qemu/qemuwrapper-cross_1.0.bb | 4 +- .../gobject-introspection_1.84.0.bb | 4 +- 14 files changed, 87 insertions(+), 73 deletions(-) create mode 100644 meta/lib/oe/qemu.py diff --git a/meta/classes-recipe/allarch.bbclass b/meta/classes-recipe/allarch.bbclass index e429b92437..fcaa580a4d 100644 --- a/meta/classes-recipe/allarch.bbclass +++ b/meta/classes-recipe/allarch.bbclass @@ -63,8 +63,6 @@ python () { d.appendVarFlag("emit_pkgdata", "vardepsexclude", " MULTILIB_VARIANTS") d.appendVarFlag("write_specfile", "vardepsexclude", " MULTILIBS") d.appendVarFlag("do_package", "vardepsexclude", " package_do_shlibs") - - d.setVar("qemu_wrapper_cmdline", "def qemu_wrapper_cmdline(data, rootfs_path, library_paths):\n return 'false'") elif bb.data.inherits_class('packagegroup', d) and not bb.data.inherits_class('nativesdk', d): bb.error("Please ensure recipe %s sets PACKAGE_ARCH before inherit packagegroup" % d.getVar("FILE")) } diff --git a/meta/classes-recipe/cmake-qemu.bbclass b/meta/classes-recipe/cmake-qemu.bbclass index 383fc74bf2..7b988f45ed 100644 --- a/meta/classes-recipe/cmake-qemu.bbclass +++ b/meta/classes-recipe/cmake-qemu.bbclass @@ -14,7 +14,7 @@ # with this use case in mind this works very nicely also out of an IDE # configured to use cmake-native for cross compiling. -inherit qemu cmake +inherit cmake DEPENDS:append:class-target = "${@' qemu-native' if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) else ''}" @@ -22,7 +22,7 @@ cmake_do_generate_toolchain_file:append:class-target() { if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then # Write out a qemu wrapper that will be used as exe_wrapper so that cmake # can run target helper binaries through that. This also allows to execute ctest. - qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}" + qemu_binary="${@oe.qemu.qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}" echo "#!/bin/sh" > "${WORKDIR}/cmake-qemuwrapper" echo "$qemu_binary \"\$@\"" >> "${WORKDIR}/cmake-qemuwrapper" chmod +x "${WORKDIR}/cmake-qemuwrapper" diff --git a/meta/classes-recipe/gtk-doc.bbclass b/meta/classes-recipe/gtk-doc.bbclass index 9d3911966b..28c0adba0a 100644 --- a/meta/classes-recipe/gtk-doc.bbclass +++ b/meta/classes-recipe/gtk-doc.bbclass @@ -35,14 +35,14 @@ DEPENDS:append = " gtk-doc-native" export STAGING_DIR_HOST -inherit python3native pkgconfig qemu +inherit python3native pkgconfig DEPENDS:append = "${@' qemu-native' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}" do_compile:prepend:class-target () { if [ ${GTKDOC_ENABLED} = True ]; then # Write out a qemu wrapper that will be given to gtkdoc-scangobj so that it # can run target helper binaries through that. - qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" + qemu_binary="${@oe.qemu.qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" cat > ${B}/gtkdoc-qemuwrapper << EOF #!/bin/sh # Use a modules directory which doesn't exist so we don't load random things diff --git a/meta/classes-recipe/libc-package.bbclass b/meta/classes-recipe/libc-package.bbclass index c06a2ce90a..ad00b2e211 100644 --- a/meta/classes-recipe/libc-package.bbclass +++ b/meta/classes-recipe/libc-package.bbclass @@ -94,8 +94,6 @@ do_collect_bins_from_locale_tree() { cross-localedef-hardlink -c -v ${WORKDIR}/locale-tree } -inherit qemu - python package_do_split_gconvs () { import re if (d.getVar('PACKAGE_NO_GCONV') == '1'): @@ -284,7 +282,7 @@ python package_do_split_gconvs () { cmd = "PATH=\"%s\" I18NPATH=\"%s\" GCONV_PATH=\"%s\" cross-localedef %s" % \ (path, i18npath, gconvpath, localedef_opts) else: # earlier slower qemu way - qemu = qemu_target_binary(d) + qemu = oe.qemu.qemu_target_binary(d) localedef_opts = "--force --no-hard-links --no-archive --prefix=%s \ --inputfile=%s/i18n/locales/%s --charmap=%s %s" \ % (treedir, datadir, locale, encoding, name) diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass index cbfc45b94b..c4e764e620 100644 --- a/meta/classes-recipe/meson.bbclass +++ b/meta/classes-recipe/meson.bbclass @@ -4,7 +4,7 @@ # SPDX-License-Identifier: MIT # -inherit python3native meson-routines qemu +inherit python3native meson-routines DEPENDS:append = " meson-native ninja-native" @@ -132,7 +132,7 @@ EOF write_qemuwrapper() { # Write out a qemu wrapper that will be used as exe_wrapper so that meson # can run target helper binaries through that. - qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" + qemu_binary="${@oe.qemu.qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" cat > ${WORKDIR}/meson-qemuwrapper << EOF #!/bin/sh # Use a modules directory which doesn't exist so we don't load random things diff --git a/meta/classes-recipe/qemu.bbclass b/meta/classes-recipe/qemu.bbclass index e9fe757c7f..5b5a26dfc9 100644 --- a/meta/classes-recipe/qemu.bbclass +++ b/meta/classes-recipe/qemu.bbclass @@ -9,56 +9,17 @@ # existence. # -def qemu_target_binary(data): - package_arch = data.getVar("PACKAGE_ARCH") - qemu_target_binary = (data.getVar("QEMU_TARGET_BINARY_%s" % package_arch) or "") - if qemu_target_binary: - return qemu_target_binary - - target_arch = data.getVar("TARGET_ARCH") - if target_arch in ("i486", "i586", "i686"): - target_arch = "i386" - elif target_arch == "powerpc": - target_arch = "ppc" - elif target_arch == "powerpc64": - target_arch = "ppc64" - elif target_arch == "powerpc64le": - target_arch = "ppc64le" +python () { + funcs = ["qemu_target_binary", "qemu_wrapper_cmdline", "qemu_run_binary"] + bb.warn("qemu.bbclass has been deprecated, please remove 'inherit qemu' and replace function invocation:\n\t%s" % + '\n\t'.join(["{0} -> oe.qemu.{0}".format(f) for f in funcs])) +} - return "qemu-" + target_arch +def qemu_target_binary(data): + return oe.qemu.qemu_target_binary(data) def qemu_wrapper_cmdline(data, rootfs_path, library_paths): - import string - - qemu_binary = qemu_target_binary(data) - if qemu_binary == "qemu-allarch": - qemu_binary = "qemuwrapper" - - qemu_options = data.getVar("QEMU_OPTIONS") or "" - - return "PSEUDO_UNLOAD=1 " + qemu_binary + " " + qemu_options + " -L " + rootfs_path\ - + " -E LD_LIBRARY_PATH=" + ":".join(library_paths) + " " + return oe.qemu.qemu_wrapper_cmdline(data, rootfs_path, library_paths) -# Next function will return a string containing the command that is needed to -# to run a certain binary through qemu. For example, in order to make a certain -# postinstall scriptlet run at do_rootfs time and running the postinstall is -# architecture dependent, we can run it through qemu. For example, in the -# postinstall scriptlet, we could use the following: -# -# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments] -# def qemu_run_binary(data, rootfs_path, binary): - libdir = rootfs_path + data.getVar("libdir", False) - base_libdir = rootfs_path + data.getVar("base_libdir", False) - - return qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir]) + rootfs_path + binary - -# QEMU_EXTRAOPTIONS is not meant to be directly used, the extensions are -# PACKAGE_ARCH, *NOT* overrides. -# In some cases (e.g. ppc) simply being arch specific (apparently) isn't good -# enough and a PACKAGE_ARCH specific -cpu option is needed (hence we have to do -# this dance). For others (e.g. arm) a -cpu option is not necessary, since the -# qemu-arm default CPU supports all required architecture levels. - -QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS:tune-%s" % d.getVar('TUNE_PKGARCH')) or ""}" -QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS:tune-${TUNE_PKGARCH}" + return oe.qemu.qemu_run_binary(data, rootfs_path, binary) diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 501808204e..b6215fd7ee 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -896,6 +896,15 @@ ZSTD_DEFAULTS[vardepsexclude] = "ZSTD_THREADS" # may fallback to using all CPUs export OMP_NUM_THREADS = "${BB_NUMBER_THREADS}" +# QEMU_EXTRAOPTIONS is not meant to be directly used, the extensions are +# PACKAGE_ARCH, *NOT* overrides. +# In some cases (e.g. ppc) simply being arch specific (apparently) isn't good +# enough and a PACKAGE_ARCH specific -cpu option is needed (hence we have to do +# this dance). For others (e.g. arm) a -cpu option is not necessary, since the +# qemu-arm default CPU supports all required architecture levels. +QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS:tune-%s" % d.getVar('TUNE_PKGARCH')) or ""}" +QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS:tune-${TUNE_PKGARCH}" + ################################################################## # Magic Cookie for SANITY CHECK ################################################################## diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py index 3179a3f3d2..f25e7f8b7c 100644 --- a/meta/lib/oe/__init__.py +++ b/meta/lib/oe/__init__.py @@ -10,5 +10,5 @@ __path__ = extend_path(__path__, __name__) # Modules with vistorcode need to go first else anything depending on them won't be # processed correctly (e.g. qa) BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \ - "packagegroup", "sstatesig", "lsb", "cachedpath", "license", \ + "packagegroup", "sstatesig", "lsb", "cachedpath", "license", "qemu", \ "reproducible", "rust", "buildcfg", "go", "spdx30_tasks", "spdx_common"] diff --git a/meta/lib/oe/qemu.py b/meta/lib/oe/qemu.py new file mode 100644 index 0000000000..769865036c --- /dev/null +++ b/meta/lib/oe/qemu.py @@ -0,0 +1,54 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: GPL-2.0-only +# + +def qemu_target_binary(d): + package_arch = d.getVar("PACKAGE_ARCH") + qemu_target_binary = (d.getVar("QEMU_TARGET_BINARY_%s" % package_arch) or "") + if qemu_target_binary: + return qemu_target_binary + + target_arch = d.getVar("TARGET_ARCH") + if target_arch in ("i486", "i586", "i686"): + target_arch = "i386" + elif target_arch == "powerpc": + target_arch = "ppc" + elif target_arch == "powerpc64": + target_arch = "ppc64" + elif target_arch == "powerpc64le": + target_arch = "ppc64le" + + return "qemu-" + target_arch + +def qemu_wrapper_cmdline(d, rootfs_path, library_paths, qemu_options=None): + import string + + package_arch = d.getVar("PACKAGE_ARCH") + if package_arch == "all": + return "false" + + qemu_binary = qemu_target_binary(d) + if qemu_binary == "qemu-allarch": + qemu_binary = "qemuwrapper" + + if qemu_options == None: + qemu_options = d.getVar("QEMU_OPTIONS") or "" + + return "PSEUDO_UNLOAD=1 " + qemu_binary + " " + qemu_options + " -L " + rootfs_path\ + + " -E LD_LIBRARY_PATH=" + ":".join(library_paths) + " " + +# Next function will return a string containing the command that is needed to +# to run a certain binary through qemu. For example, in order to make a certain +# postinstall scriptlet run at do_rootfs time and running the postinstall is +# architecture dependent, we can run it through qemu. For example, in the +# postinstall scriptlet, we could use the following: +# +# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments] +# +def qemu_run_binary(d, rootfs_path, binary): + libdir = rootfs_path + d.getVar("libdir", False) + base_libdir = rootfs_path + d.getVar("base_libdir", False) + + return qemu_wrapper_cmdline(d, rootfs_path, [libdir, base_libdir]) + rootfs_path + binary diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.41.bb b/meta/recipes-core/glibc/glibc-testsuite_2.41.bb index 3a2764e40b..d5e3a2cb19 100644 --- a/meta/recipes-core/glibc/glibc-testsuite_2.41.bb +++ b/meta/recipes-core/glibc/glibc-testsuite_2.41.bb @@ -1,8 +1,6 @@ require glibc_${PV}.bb require glibc-tests.inc -inherit qemu - SRC_URI += "file://check-test-wrapper" # strip provides @@ -22,7 +20,7 @@ do_check:append () { oe_runmake -i \ QEMU_SYSROOT="${RECIPE_SYSROOT}" \ - QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \ + QEMU_OPTIONS="${@oe.qemu.qemu_target_binary(d)} ${QEMU_OPTIONS}" \ SSH_HOST="${TOOLCHAIN_TEST_HOST}" \ SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \ SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \ diff --git a/meta/recipes-devtools/gcc/gcc-testsuite.inc b/meta/recipes-devtools/gcc/gcc-testsuite.inc index 3257f86907..42f7f244c3 100644 --- a/meta/recipes-devtools/gcc/gcc-testsuite.inc +++ b/meta/recipes-devtools/gcc/gcc-testsuite.inc @@ -1,5 +1,3 @@ -inherit qemu - TOOLCHAIN_TEST_TARGET ??= "user" TOOLCHAIN_TEST_HOST ??= "localhost" TOOLCHAIN_TEST_HOST_USER ??= "root" @@ -41,7 +39,7 @@ python check_prepare() { content.append('process_multilib_options ""') # qemu args - qemu_binary = qemu_target_binary(d) + qemu_binary = oe.qemu.qemu_target_binary(d) if not qemu_binary: bb.fatal("Missing target qemu linux-user binary") diff --git a/meta/recipes-devtools/python/python3_3.13.2.bb b/meta/recipes-devtools/python/python3_3.13.2.bb index 0f0505c66c..30835796e9 100644 --- a/meta/recipes-devtools/python/python3_3.13.2.bb +++ b/meta/recipes-devtools/python/python3_3.13.2.bb @@ -57,7 +57,7 @@ S = "${WORKDIR}/Python-${PV}" BBCLASSEXTEND = "native nativesdk" -inherit autotools pkgconfig qemu ptest multilib_header update-alternatives +inherit autotools pkgconfig ptest multilib_header update-alternatives MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" @@ -168,7 +168,7 @@ write_pgo_wrapper() { cat >pgo-wrapper <<EOF #!/bin/sh cd ${B} -${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])} "\$@" +${@oe.qemu.qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])} "\$@" EOF chmod +x pgo-wrapper fi diff --git a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb index 6d0e7883ad..9fe43a6ce2 100644 --- a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb +++ b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb @@ -7,14 +7,12 @@ UNPACKDIR = "${S}" DEPENDS += "qemu-native" -inherit qemu - do_populate_sysroot[depends] = "" do_install () { install -d ${D}${bindir_crossscripts}/ - qemu_binary=${@qemu_target_binary(d)} + qemu_binary=${@oe.qemu.qemu_target_binary(d)} qemu_options='${QEMU_OPTIONS} -E LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir}' cat >> ${D}${bindir_crossscripts}/${MLPREFIX}qemuwrapper << EOF diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.84.0.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.84.0.bb index ac5f4e9370..3110c151a6 100644 --- a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.84.0.bb +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.84.0.bb @@ -20,7 +20,7 @@ SRC_URI[sha256sum] = "945b57da7ec262e5c266b89e091d14be800cc424277d82a02872b7d794 SRC_URI:append:class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch" -inherit meson pkgconfig gtk-doc python3targetconfig qemu gobject-introspection-data upstream-version-is-even multilib_script +inherit meson pkgconfig gtk-doc python3targetconfig gobject-introspection-data upstream-version-is-even multilib_script GTKDOC_MESON_OPTION = "gtk_doc" @@ -64,7 +64,7 @@ do_configure:prepend:class-native() { do_configure:prepend:class-target() { # Write out a qemu wrapper that will be given to gi-scanner so that it # can run target helper binaries through that. - qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" + qemu_binary="${@oe.qemu.qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" cat > ${B}/g-ir-scanner-qemuwrapper << EOF #!/bin/sh # Use a modules directory which doesn't exist so we don't load random things -- 2.49.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions 2025-04-10 4:08 ` [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions Qi.Chen @ 2025-04-10 7:50 ` Alexander Kanavin 2025-04-10 8:54 ` Chen, Qi 0 siblings, 1 reply; 9+ messages in thread From: Alexander Kanavin @ 2025-04-10 7:50 UTC (permalink / raw) To: Qi.Chen; +Cc: openembedded-core On Thu, 10 Apr 2025 at 06:08, Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > - > - d.setVar("qemu_wrapper_cmdline", "def qemu_wrapper_cmdline(data, rootfs_path, library_paths):\n return 'false'") (in allarch.bbclass) I wonder about this, is there a reason this was added (perhaps via 'git blame')? Is it ok to simply remove it? Otherwise looks fine. Alex ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions 2025-04-10 7:50 ` Alexander Kanavin @ 2025-04-10 8:54 ` Chen, Qi 0 siblings, 0 replies; 9+ messages in thread From: Chen, Qi @ 2025-04-10 8:54 UTC (permalink / raw) To: Alexander Kanavin; +Cc: openembedded-core@lists.openembedded.org I moved it to the qemu_wrapper_cmdline function itself in meta/lib/oe/qemu.py. I'll put this info in the commit message in V2. Regards, Qi -----Original Message----- From: Alexander Kanavin <alex.kanavin@gmail.com> Sent: Thursday, April 10, 2025 3:51 PM To: Chen, Qi <Qi.Chen@windriver.com> Cc: openembedded-core@lists.openembedded.org Subject: Re: [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions On Thu, 10 Apr 2025 at 06:08, Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > - > - d.setVar("qemu_wrapper_cmdline", "def qemu_wrapper_cmdline(data, rootfs_path, library_paths):\n return 'false'") (in allarch.bbclass) I wonder about this, is there a reason this was added (perhaps via 'git blame')? Is it ok to simply remove it? Otherwise looks fine. Alex ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency 2025-04-10 4:08 [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency Qi.Chen 2025-04-10 4:08 ` [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions Qi.Chen @ 2025-04-10 6:15 ` Richard Purdie 2025-04-10 6:31 ` Chen, Qi 1 sibling, 1 reply; 9+ messages in thread From: Richard Purdie @ 2025-04-10 6:15 UTC (permalink / raw) To: Qi.Chen, openembedded-core On Wed, 2025-04-09 at 21:08 -0700, Chen Qi via lists.openembedded.org wrote: > From: Chen Qi <Qi.Chen@windriver.com> > > Some classes/recipes inherit qemu.bbclass but does not actually use anything > from it. Besides, putting qemu-native in PACKAGE_WRITE_DEPS is not needed because > the process of generating package does not need qemu-native. > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > meta/classes-recipe/fontcache.bbclass | 3 --- > meta/classes-recipe/gio-module-cache.bbclass | 3 --- > meta/classes-recipe/gtk-immodules-cache.bbclass | 4 ---- > meta/classes-recipe/manpages.bbclass | 2 -- > meta/classes-recipe/pixbufcache.bbclass | 5 +---- > meta/recipes-core/systemd/systemd_257.4.bb | 3 +-- > meta/recipes-core/udev/eudev_3.2.14.bb | 2 +- > 7 files changed, 3 insertions(+), 19 deletions(-) > > diff --git a/meta/classes-recipe/fontcache.bbclass b/meta/classes-recipe/fontcache.bbclass > index 6f4978369d..6082af08f3 100644 > --- a/meta/classes-recipe/fontcache.bbclass > +++ b/meta/classes-recipe/fontcache.bbclass > @@ -9,9 +9,6 @@ > # packages. > # > > -PACKAGE_WRITE_DEPS += "qemu-native" > -inherit qemu > - > FONT_PACKAGES ??= "${PN}" > FONT_PACKAGES:class-native = "" > FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils" I picked one of these to validate this as I didn't quite believe we didn't use qemu there. fontconfig.bbclass has: fontcache_common() { if [ -n "$D" ] ; then $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \ in it's postinstall script. Then in scripts/postinst- intercepts/update_font_cache we have: PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams} so I'm afraid it does use qemu and you can't simply drop the class inherit or dependency as it is used. Cheers, Richard ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency 2025-04-10 6:15 ` [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency Richard Purdie @ 2025-04-10 6:31 ` Chen, Qi 2025-04-10 6:42 ` Richard Purdie 0 siblings, 1 reply; 9+ messages in thread From: Chen, Qi @ 2025-04-10 6:31 UTC (permalink / raw) To: Richard Purdie, openembedded-core@lists.openembedded.org Hi Richard, The postinst uses qemuwrapper which in turns uses qemu-native. But the postinst runs at do_rootfs time. And this dependency is ensured by the following line: meta/classes-recipe/image.bbclass:DEPENDS += "${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross depmodwrapper-cross cross-localedef-native" PACKAGE_WRITE_DEPS is for do_package_write_rpm/deb/ipk. These tasks do not run postinst and thus not using qemu-native. So 'qemu-native' can be removed from PACKAGE_WRITE_DEPS safely. For the removal of qemu.bbclass inherit, these classes/recipes do not really use any function from this qemu.bbclass. So we can safely remove 'inherit qemu' for them. My test for this patch 1/2 is: qemux86-64 + systemd + bitbake core-image-sato. There's no error. Regards, Qi -----Original Message----- From: Richard Purdie <richard.purdie@linuxfoundation.org> Sent: Thursday, April 10, 2025 2:15 PM To: Chen, Qi <Qi.Chen@windriver.com>; openembedded-core@lists.openembedded.org Subject: Re: [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency On Wed, 2025-04-09 at 21:08 -0700, Chen Qi via lists.openembedded.org wrote: > From: Chen Qi <Qi.Chen@windriver.com> > > Some classes/recipes inherit qemu.bbclass but does not actually use > anything from it. Besides, putting qemu-native in PACKAGE_WRITE_DEPS > is not needed because the process of generating package does not need qemu-native. > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > meta/classes-recipe/fontcache.bbclass | 3 --- > meta/classes-recipe/gio-module-cache.bbclass | 3 --- > meta/classes-recipe/gtk-immodules-cache.bbclass | 4 ---- > meta/classes-recipe/manpages.bbclass | 2 -- > meta/classes-recipe/pixbufcache.bbclass | 5 +---- > meta/recipes-core/systemd/systemd_257.4.bb | 3 +-- > meta/recipes-core/udev/eudev_3.2.14.bb | 2 +- > 7 files changed, 3 insertions(+), 19 deletions(-) > > diff --git a/meta/classes-recipe/fontcache.bbclass > b/meta/classes-recipe/fontcache.bbclass > index 6f4978369d..6082af08f3 100644 > --- a/meta/classes-recipe/fontcache.bbclass > +++ b/meta/classes-recipe/fontcache.bbclass > @@ -9,9 +9,6 @@ > # packages. > # > > -PACKAGE_WRITE_DEPS += "qemu-native" > -inherit qemu > - > FONT_PACKAGES ??= "${PN}" > FONT_PACKAGES:class-native = "" > FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils" I picked one of these to validate this as I didn't quite believe we didn't use qemu there. fontconfig.bbclass has: fontcache_common() { if [ -n "$D" ] ; then $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \ in it's postinstall script. Then in scripts/postinst- intercepts/update_font_cache we have: PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams} so I'm afraid it does use qemu and you can't simply drop the class inherit or dependency as it is used. Cheers, Richard ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency 2025-04-10 6:31 ` Chen, Qi @ 2025-04-10 6:42 ` Richard Purdie 2025-04-10 6:45 ` Chen, Qi 0 siblings, 1 reply; 9+ messages in thread From: Richard Purdie @ 2025-04-10 6:42 UTC (permalink / raw) To: Chen, Qi, openembedded-core@lists.openembedded.org On Thu, 2025-04-10 at 06:31 +0000, Chen, Qi wrote: > The postinst uses qemuwrapper which in turns uses qemu-native. But > the postinst runs at do_rootfs time. And this dependency is ensured > by the following line: > meta/classes-recipe/image.bbclass:DEPENDS += "${@' '.join(["%s- > qemuwrapper-cross" % m for m in > d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross > depmodwrapper-cross cross-localedef-native" > > PACKAGE_WRITE_DEPS is for do_package_write_rpm/deb/ipk. These tasks > do not run postinst and thus not using qemu-native. So 'qemu-native' > can be removed from PACKAGE_WRITE_DEPS safely. > > For the removal of qemu.bbclass inherit, these classes/recipes do not > really use any function from this qemu.bbclass. So we can safely > remove 'inherit qemu' for them. > > My test for this patch 1/2 is: qemux86-64 + systemd + bitbake core- > image-sato. There's no error. Something needs to trigger the system to have qemu-native available at do_rootfs time since these recipes write a postinstall which can use qemu. That is what PACKAGE_WRITE_DEPS is for. I suspect you're pulling in qemu through other dependencies but that doesn't mean this one is unneeded. package.bbclass has a comment about this: # If your postinstall can execute at rootfs creation time rather than on # target but depends on a native/cross tool in order to execute, you need to # list that tool in PACKAGE_WRITE_DEPS. Target package dependencies belong # in the package dependencies as normal, this is just for native/cross support # tools at rootfs build time. PACKAGE_WRITE_DEPS ??= "" As for the qemu class inherit, the code used to write the qemu binary call into the postinst but it uses qemuwrapper now which comes from qemuwrapper-cross. I suspect you're right that it means the qemu inherit is no longer needed however we should probably change the inherit qemu for a PACKAGE_WRITE_DEPS += "qemuwrapper-cross"? (and see if we could remove the dependency in image.bbclass?) Cheers, Richard ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency 2025-04-10 6:42 ` Richard Purdie @ 2025-04-10 6:45 ` Chen, Qi 2025-04-10 7:27 ` Richard Purdie 0 siblings, 1 reply; 9+ messages in thread From: Chen, Qi @ 2025-04-10 6:45 UTC (permalink / raw) To: Richard Purdie, openembedded-core@lists.openembedded.org Got it. Thanks for the detailed explanation. I'll check and send out V2. Regards, Qi -----Original Message----- From: Richard Purdie <richard.purdie@linuxfoundation.org> Sent: Thursday, April 10, 2025 2:42 PM To: Chen, Qi <Qi.Chen@windriver.com>; openembedded-core@lists.openembedded.org Subject: Re: [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency On Thu, 2025-04-10 at 06:31 +0000, Chen, Qi wrote: > The postinst uses qemuwrapper which in turns uses qemu-native. But the > postinst runs at do_rootfs time. And this dependency is ensured by the > following line: > meta/classes-recipe/image.bbclass:DEPENDS += "${@' '.join(["%s- > qemuwrapper-cross" % m for m in > d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross > depmodwrapper-cross cross-localedef-native" > > PACKAGE_WRITE_DEPS is for do_package_write_rpm/deb/ipk. These tasks > do not run postinst and thus not using qemu-native. So 'qemu-native' > can be removed from PACKAGE_WRITE_DEPS safely. > > For the removal of qemu.bbclass inherit, these classes/recipes do not > really use any function from this qemu.bbclass. So we can safely > remove 'inherit qemu' for them. > > My test for this patch 1/2 is: qemux86-64 + systemd + bitbake core- > image-sato. There's no error. Something needs to trigger the system to have qemu-native available at do_rootfs time since these recipes write a postinstall which can use qemu. That is what PACKAGE_WRITE_DEPS is for. I suspect you're pulling in qemu through other dependencies but that doesn't mean this one is unneeded. package.bbclass has a comment about this: # If your postinstall can execute at rootfs creation time rather than on # target but depends on a native/cross tool in order to execute, you need to # list that tool in PACKAGE_WRITE_DEPS. Target package dependencies belong # in the package dependencies as normal, this is just for native/cross support # tools at rootfs build time. PACKAGE_WRITE_DEPS ??= "" As for the qemu class inherit, the code used to write the qemu binary call into the postinst but it uses qemuwrapper now which comes from qemuwrapper-cross. I suspect you're right that it means the qemu inherit is no longer needed however we should probably change the inherit qemu for a PACKAGE_WRITE_DEPS += "qemuwrapper-cross"? (and see if we could remove the dependency in image.bbclass?) Cheers, Richard ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency 2025-04-10 6:45 ` Chen, Qi @ 2025-04-10 7:27 ` Richard Purdie 0 siblings, 0 replies; 9+ messages in thread From: Richard Purdie @ 2025-04-10 7:27 UTC (permalink / raw) To: Chen, Qi, openembedded-core@lists.openembedded.org > As for the qemu class inherit, the code used to write the qemu binary > call into the postinst but it uses qemuwrapper now which comes from > qemuwrapper-cross. I suspect you're right that it means the qemu > inherit is no longer needed however we should probably change the > inherit qemu for a PACKAGE_WRITE_DEPS += "qemuwrapper-cross"? > > (and see if we could remove the dependency in image.bbclass?) I was thinking about this further and I think we could replace the qemu-native dependency for a qemuwrapper-cross dependency since that has the correct qemu-native dependency. Cheers, Richard ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-04-10 8:54 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-10 4:08 [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency Qi.Chen 2025-04-10 4:08 ` [OE-core][PATCH 2/2] lib/classes/recipes: refactor qemu.bbclass functions into library functions Qi.Chen 2025-04-10 7:50 ` Alexander Kanavin 2025-04-10 8:54 ` Chen, Qi 2025-04-10 6:15 ` [OE-core][PATCH 1/2] classes/recipes: remove unnecessary qemu inherit and qemu-native dependency Richard Purdie 2025-04-10 6:31 ` Chen, Qi 2025-04-10 6:42 ` Richard Purdie 2025-04-10 6:45 ` Chen, Qi 2025-04-10 7:27 ` Richard Purdie
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox