From 61cec3e210f58e0c6d05cde1012d0cf6ea072795 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Wed, 10 Jul 2024 03:45:58 +0000 Subject: libvirt: update to v10.5.0 and convert to git Rather than waiting for release tarballs for the main libvirt release, we can just use the git repository directory and avoid patch backporting for CVEs, etc. As part of this change, we adjust to git, refresh our meson build patch, and add a new meson patch for the tests. We also split out LIBVIRT_VERSION, so that nested builds can use it to locate tarballs. Signed-off-by: Bruce Ashfield --- recipes-extended/libvirt/libvirt-python.inc | 8 +- ...-clear-abs_top_builddir-to-avoid-QA-warni.patch | 31 ++ ...ests-meson-clear-absolute-directory-paths.patch | 38 +++ recipes-extended/libvirt/libvirt_10.0.0.bb | 333 -------------------- recipes-extended/libvirt/libvirt_git.bb | 340 +++++++++++++++++++++ 5 files changed, 413 insertions(+), 337 deletions(-) create mode 100644 recipes-extended/libvirt/libvirt/0001-meson.build-clear-abs_top_builddir-to-avoid-QA-warni.patch create mode 100644 recipes-extended/libvirt/libvirt/0001-tests-meson-clear-absolute-directory-paths.patch delete mode 100644 recipes-extended/libvirt/libvirt_10.0.0.bb create mode 100644 recipes-extended/libvirt/libvirt_git.bb (limited to 'recipes-extended') diff --git a/recipes-extended/libvirt/libvirt-python.inc b/recipes-extended/libvirt/libvirt-python.inc index 40c362d6..471d33d6 100644 --- a/recipes-extended/libvirt/libvirt-python.inc +++ b/recipes-extended/libvirt/libvirt-python.inc @@ -18,9 +18,9 @@ FILES:${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" # Currently the libvirt-python debug libraries contain buildpaths INSANE_SKIP:${PN}-dbg += "buildpaths" -SRC_URI += "http://libvirt.org/sources/python/${BPN}-python-${PV}.tar.gz;name=libvirt_python;subdir=${BP}" +SRC_URI += "http://libvirt.org/sources/python/${BPN}-python-${LIBVIRT_VERSION}.tar.gz;name=libvirt_python;subdir=${BP}" -SRC_URI[libvirt_python.sha256sum] = "a82588f0e7db53eda7b7dbcbc448b0ec43e00a8c77cac69644495299b410c20d" +SRC_URI[libvirt_python.sha256sum] = "785023500f58d3e8e829af98647d43eee97e517aacc9d9e7ded43594ea52d032" export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml" export LIBVIRT_CFLAGS = "-I${S}/include" @@ -46,7 +46,7 @@ do_compile:append() { # the syroot staged pkgconfig entries. So we clear the sysroot # for just this portion. export PKG_CONFIG_SYSROOT_DIR= - cd ${S}/${BPN}-python-${PV} && \ + cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \ ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build cd - fi @@ -58,7 +58,7 @@ do_install:append() { # the syroot staged pkgconfig entries. So we clear the sysroot # for just this portion. export PKG_CONFIG_SYSROOT_DIR= - cd ${S}/${BPN}-python-${PV} && \ + cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \ ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py install \ --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS} cd - diff --git a/recipes-extended/libvirt/libvirt/0001-meson.build-clear-abs_top_builddir-to-avoid-QA-warni.patch b/recipes-extended/libvirt/libvirt/0001-meson.build-clear-abs_top_builddir-to-avoid-QA-warni.patch new file mode 100644 index 00000000..04db24d0 --- /dev/null +++ b/recipes-extended/libvirt/libvirt/0001-meson.build-clear-abs_top_builddir-to-avoid-QA-warni.patch @@ -0,0 +1,31 @@ +From d06f0795cfd097c373c7b9824ce59f17c9194520 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield +Date: Tue, 9 Jul 2024 21:23:47 +0000 +Subject: [PATCH] meson.build: clear abs_top_builddir to avoid QA warnings + +If we don't clear the absolute directories from the build, +we'll get QA warnings on packaging. + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Bruce Ashfield +--- + src/meson.build | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/meson.build b/src/meson.build +index 8cce42c7ad..dc7a81c980 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -3,8 +3,6 @@ src_inc_dir = include_directories('.') + src_dep = declare_dependency( + compile_args: [ + '-DIN_LIBVIRT', +- '-Dabs_top_builddir="@0@"'.format(meson.project_build_root()), +- '-Dabs_top_srcdir="@0@"'.format(meson.project_source_root()), + ] + coverage_flags + win32_flags, + dependencies: [ + glib_dep, +-- +2.39.2 + diff --git a/recipes-extended/libvirt/libvirt/0001-tests-meson-clear-absolute-directory-paths.patch b/recipes-extended/libvirt/libvirt/0001-tests-meson-clear-absolute-directory-paths.patch new file mode 100644 index 00000000..4cbe4913 --- /dev/null +++ b/recipes-extended/libvirt/libvirt/0001-tests-meson-clear-absolute-directory-paths.patch @@ -0,0 +1,38 @@ +From 05ef0d41895a355601333b5caa413754272fce03 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield +Date: Tue, 9 Jul 2024 23:06:39 +0000 +Subject: [PATCH] tests/meson: clear absolute directory paths + +Ensure that the abs_* directory definitions are cleared, so +they'll be consistent with the top level definitions and so +we won't hav QA warnings due to tmpdir references in the +resulting binaries. + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Bruce Ashfield +--- + tests/meson.build | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/meson.build b/tests/meson.build +index 2f1eda1f95..6fa8308385 100644 +--- a/tests/meson.build ++++ b/tests/meson.build +@@ -1,9 +1,9 @@ + tests_dep = declare_dependency( + compile_args: [ +- '-Dabs_builddir="@0@"'.format(meson.current_build_dir()), +- '-Dabs_top_builddir="@0@"'.format(meson.project_build_root()), +- '-Dabs_srcdir="@0@"'.format(meson.current_source_dir()), +- '-Dabs_top_srcdir="@0@"'.format(meson.project_source_root()), ++ '-Dabs_builddir="@0@"'.format(' '), ++ '-Dabs_top_builddir="@0@"'.format(' '), ++ '-Dabs_srcdir="@0@"'.format(' '), ++ '-Dabs_top_srcdir="@0@"'.format(' '), + ] + coverage_flags + cc_flags_relaxed_frame_limit, + dependencies: [ + apparmor_dep, +-- +2.39.2 + diff --git a/recipes-extended/libvirt/libvirt_10.0.0.bb b/recipes-extended/libvirt/libvirt_10.0.0.bb deleted file mode 100644 index 8e54406a..00000000 --- a/recipes-extended/libvirt/libvirt_10.0.0.bb +++ /dev/null @@ -1,333 +0,0 @@ -DESCRIPTION = "A toolkit to interact with the virtualization capabilities of recent versions of Linux." -HOMEPAGE = "http://libvirt.org" -LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.LESSER;md5=4b54a1fd55a448865a0b32d41598759d" -SECTION = "console/tools" - -DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \ - iptables dnsmasq readline libtasn1 libxslt-native acl libdevmapper libtirpc \ - python3-docutils-native \ - ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'shadow-native', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'gnutls', 'gnutls-native', '', d)}" - -# libvirt-guests.sh needs gettext.sh -# -RDEPENDS:${PN} = "gettext-runtime" - -RDEPENDS:libvirt-libvirtd += "bridge-utils iptables pm-utils dnsmasq netcat-openbsd ebtables" -RDEPENDS:libvirt-libvirtd:append:x86-64 = " dmidecode" -RDEPENDS:libvirt-libvirtd:append:x86 = " dmidecode" -RDEPENDS:libvirt-libvirtd:append:arm = " dmidecode" -RDEPENDS:libvirt-libvirtd:append:aarch64 = " dmidecode" - -#connman blocks the 53 port and libvirtd can't start its DNS service -RCONFLICTS:${PN}_libvirtd = "connman" - -SRC_URI = "http://libvirt.org/sources/${BP}.tar.xz;name=libvirt \ - file://libvirtd.sh \ - file://libvirtd.conf \ - file://dnsmasq.conf \ - file://hook_support.py \ - file://gnutls-helper.py;subdir=${BP} \ - file://0001-prevent-gendispatch.pl-generating-build-path-in-code.patch \ - file://0001-messon.build-remove-build-path-information-to-avoid-.patch \ - " - -SRC_URI[libvirt.sha256sum] = "8ba2e72ec8bdd2418554a1474c42c35704c30174b7611eaf9a16544b71bcf00a" - -inherit meson gettext update-rc.d pkgconfig systemd useradd perlnative -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM:${PN} = "-r qemu; -r kvm" -USERADD_PARAM:${PN} = "-r -g qemu -G kvm qemu" - - -EXTRA_OEMESON += "--cross-file ${WORKDIR}/meson-${PN}.cross" -do_write_config:append() { - cat >${WORKDIR}/meson-${PN}.cross < ${D}${sysconfdir}/default/volatiles/99_libvirt - echo "d root root 0755 /run/libvirt/lockd none" \ - >> ${D}${sysconfdir}/default/volatiles/99_libvirt - echo "d root root 0755 /run/libvirt/lxc none" \ - >> ${D}${sysconfdir}/default/volatiles/99_libvirt - echo "d root root 0755 /run/libvirt/network none" \ - >> ${D}${sysconfdir}/default/volatiles/99_libvirt - echo "d root root 0755 /run/libvirt/qemu none" \ - >> ${D}${sysconfdir}/default/volatiles/99_libvirt - - # Manually set permissions and ownership to match polkit recipe - if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then - install -d -m 0700 ${D}/${datadir}/polkit-1/rules.d - chown polkitd ${D}/${datadir}/polkit-1/rules.d - chgrp root ${D}/${datadir}/polkit-1/rules.d - else - rm -rf ${D}/${datadir}/polkit-1 - fi - - # disable seccomp_sandbox - if [ -e ${D}${sysconfdir}/libvirt/qemu.conf ] ; then - sed -i '/^#seccomp_sandbox = 1/aseccomp_sandbox = 0' \ - ${D}${sysconfdir}/libvirt/qemu.conf - fi - - # Add hook support for libvirt - mkdir -p ${D}/etc/libvirt/hooks - for hook in "daemon" "lxc" "network" "qemu" - do - install -m 0755 ${UNPACKDIR}/hook_support.py ${D}/etc/libvirt/hooks/${hook} - done - - # Force the main dnsmasq instance to bind only to specified interfaces and - # to not bind to virbr0. Libvirt will run its own instance on this interface. - install -m 644 ${UNPACKDIR}/dnsmasq.conf ${D}/${sysconfdir}/dnsmasq.d/libvirt-daemon - - # remove .la references to our working diretory - for i in `find ${D}${libdir} -type f -name *.la`; do - sed -i -e 's#-L${B}/src/.libs##g' $i - done - - sed -i -e 's/^\(unix_sock_group\ =\ \).*/\1"kvm"/' ${D}/etc/libvirt/libvirtd.conf - sed -i -e 's/^\(unix_sock_rw_perms\ =\ \).*/\1"0776"/' ${D}/etc/libvirt/libvirtd.conf - - case ${MACHINE_ARCH} in - *mips*) - break - ;; - *) - if ${@bb.utils.contains('PACKAGECONFIG', 'qemu', 'true', 'false', d)}; then - chown -R qemu:qemu ${D}/${localstatedir}/lib/libvirt/qemu - echo "d qemu qemu 0755 ${localstatedir}/cache/libvirt/qemu none" \ - >> ${D}${sysconfdir}/default/volatiles/99_libvirt - break - fi - ;; - esac - - if ${@bb.utils.contains('PACKAGECONFIG','gnutls','true','false',d)}; then - # Generate sample keys and certificates. - ${S}/gnutls-helper.py -y - - # Deploy all sample keys and certificates of CA, server and client - # to target so that libvirtd is able to boot successfully and local - # connection via 127.0.0.1 is available out of box. - install -d ${D}/etc/pki/CA - install -d ${D}/etc/pki/libvirt/private - install -m 0755 ${S}/gnutls-helper.py ${D}/${bindir} - install -m 0644 cakey.pem ${D}/${sysconfdir}/pki/libvirt/private/cakey.pem - install -m 0644 cacert.pem ${D}/${sysconfdir}/pki/CA/cacert.pem - install -m 0644 serverkey.pem ${D}/${sysconfdir}/pki/libvirt/private/serverkey.pem - install -m 0644 servercert.pem ${D}/${sysconfdir}/pki/libvirt/servercert.pem - install -m 0644 clientkey.pem ${D}/${sysconfdir}/pki/libvirt/private/clientkey.pem - install -m 0644 clientcert.pem ${D}/${sysconfdir}/pki/libvirt/clientcert.pem - - # Force the connection to be tls. - sed -i -e 's/^\(listen_tls\ =\ .*\)/#\1/' -e 's/^\(listen_tcp\ =\ .*\)/#\1/' ${D}/etc/libvirt/libvirtd.conf - fi - - # virt-login-shell needs to run with setuid permission - chmod 4755 ${D}${bindir}/virt-login-shell -} - -EXTRA_OEMESON += " \ - -Dinit_script=${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd','none', d)} \ - -Drunstatedir=/run \ - -Dtests=enabled \ - " - -# gcc9 end up mis-compiling qemuxml2argvtest.o with Og which then -# crashes on target, so remove -Og and use -O2 as workaround -SELECTED_OPTIMIZATION:remove:virtclass-multilib-lib32:mipsarch = "-Og" -SELECTED_OPTIMIZATION:append:virtclass-multilib-lib32:mipsarch = " -O2" - -pkg_postinst:${PN}() { - if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then - /etc/init.d/populate-volatile.sh update - fi - mkdir -m 711 -p $D/data/images -} - -python () { - if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): - d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") -} diff --git a/recipes-extended/libvirt/libvirt_git.bb b/recipes-extended/libvirt/libvirt_git.bb new file mode 100644 index 00000000..20203ec2 --- /dev/null +++ b/recipes-extended/libvirt/libvirt_git.bb @@ -0,0 +1,340 @@ +DESCRIPTION = "A toolkit to interact with the virtualization capabilities of recent versions of Linux." +HOMEPAGE = "http://libvirt.org" +LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.LESSER;md5=4b54a1fd55a448865a0b32d41598759d" +SECTION = "console/tools" + +DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \ + iptables dnsmasq readline libtasn1 libxslt-native acl libdevmapper libtirpc \ + python3-docutils-native \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'shadow-native', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'gnutls', 'gnutls-native', '', d)}" + +# libvirt-guests.sh needs gettext.sh +# +RDEPENDS:${PN} = "gettext-runtime" + +RDEPENDS:libvirt-libvirtd += "bridge-utils iptables pm-utils dnsmasq netcat-openbsd ebtables" +RDEPENDS:libvirt-libvirtd:append:x86-64 = " dmidecode" +RDEPENDS:libvirt-libvirtd:append:x86 = " dmidecode" +RDEPENDS:libvirt-libvirtd:append:arm = " dmidecode" +RDEPENDS:libvirt-libvirtd:append:aarch64 = " dmidecode" + +#connman blocks the 53 port and libvirtd can't start its DNS service +RCONFLICTS:${PN}_libvirtd = "connman" + +SRCREV_libvirt = "0d3e962d47470165b28f742704385acefd70327e" + +LIBVIRT_VERSION = "10.5.0" +PV = "v${LIBVIRT_VERSION}+git" + +SRC_URI = "gitsm://github.com/libvirt/libvirt.git;name=libvirt;protocol=https;branch=master \ + file://libvirtd.sh \ + file://libvirtd.conf \ + file://dnsmasq.conf \ + file://hook_support.py \ + file://gnutls-helper.py;subdir=${BP} \ + file://0001-prevent-gendispatch.pl-generating-build-path-in-code.patch \ + file://0001-messon.build-remove-build-path-information-to-avoid-.patch \ + file://0001-meson.build-clear-abs_top_builddir-to-avoid-QA-warni.patch \ + file://0001-tests-meson-clear-absolute-directory-paths.patch \ + " + +S = "${WORKDIR}/git" + +inherit meson gettext update-rc.d pkgconfig systemd useradd perlnative +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM:${PN} = "-r qemu; -r kvm" +USERADD_PARAM:${PN} = "-r -g qemu -G kvm qemu" + + +EXTRA_OEMESON += "--cross-file ${WORKDIR}/meson-${PN}.cross" +do_write_config:append() { + cat >${WORKDIR}/meson-${PN}.cross < ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 /run/libvirt/lockd none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 /run/libvirt/lxc none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 /run/libvirt/network none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 /run/libvirt/qemu none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + + # Manually set permissions and ownership to match polkit recipe + if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then + install -d -m 0700 ${D}/${datadir}/polkit-1/rules.d + chown polkitd ${D}/${datadir}/polkit-1/rules.d + chgrp root ${D}/${datadir}/polkit-1/rules.d + else + rm -rf ${D}/${datadir}/polkit-1 + fi + + # disable seccomp_sandbox + if [ -e ${D}${sysconfdir}/libvirt/qemu.conf ] ; then + sed -i '/^#seccomp_sandbox = 1/aseccomp_sandbox = 0' \ + ${D}${sysconfdir}/libvirt/qemu.conf + fi + + # Add hook support for libvirt + mkdir -p ${D}/etc/libvirt/hooks + for hook in "daemon" "lxc" "network" "qemu" + do + install -m 0755 ${UNPACKDIR}/hook_support.py ${D}/etc/libvirt/hooks/${hook} + done + + # Force the main dnsmasq instance to bind only to specified interfaces and + # to not bind to virbr0. Libvirt will run its own instance on this interface. + install -m 644 ${UNPACKDIR}/dnsmasq.conf ${D}/${sysconfdir}/dnsmasq.d/libvirt-daemon + + # remove .la references to our working diretory + for i in `find ${D}${libdir} -type f -name *.la`; do + sed -i -e 's#-L${B}/src/.libs##g' $i + done + + sed -i -e 's/^\(unix_sock_group\ =\ \).*/\1"kvm"/' ${D}/etc/libvirt/libvirtd.conf + sed -i -e 's/^\(unix_sock_rw_perms\ =\ \).*/\1"0776"/' ${D}/etc/libvirt/libvirtd.conf + + case ${MACHINE_ARCH} in + *mips*) + break + ;; + *) + if ${@bb.utils.contains('PACKAGECONFIG', 'qemu', 'true', 'false', d)}; then + chown -R qemu:qemu ${D}/${localstatedir}/lib/libvirt/qemu + echo "d qemu qemu 0755 ${localstatedir}/cache/libvirt/qemu none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + break + fi + ;; + esac + + if ${@bb.utils.contains('PACKAGECONFIG','gnutls','true','false',d)}; then + # Generate sample keys and certificates. + ${UNPACKDIR}/${BP}/gnutls-helper.py -y + + # Deploy all sample keys and certificates of CA, server and client + # to target so that libvirtd is able to boot successfully and local + # connection via 127.0.0.1 is available out of box. + install -d ${D}/etc/pki/CA + install -d ${D}/etc/pki/libvirt/private + install -m 0755 ${UNPACKDIR}/${BP}/gnutls-helper.py ${D}/${bindir} + install -m 0644 cakey.pem ${D}/${sysconfdir}/pki/libvirt/private/cakey.pem + install -m 0644 cacert.pem ${D}/${sysconfdir}/pki/CA/cacert.pem + install -m 0644 serverkey.pem ${D}/${sysconfdir}/pki/libvirt/private/serverkey.pem + install -m 0644 servercert.pem ${D}/${sysconfdir}/pki/libvirt/servercert.pem + install -m 0644 clientkey.pem ${D}/${sysconfdir}/pki/libvirt/private/clientkey.pem + install -m 0644 clientcert.pem ${D}/${sysconfdir}/pki/libvirt/clientcert.pem + + # Force the connection to be tls. + sed -i -e 's/^\(listen_tls\ =\ .*\)/#\1/' -e 's/^\(listen_tcp\ =\ .*\)/#\1/' ${D}/etc/libvirt/libvirtd.conf + fi + + # virt-login-shell needs to run with setuid permission + chmod 4755 ${D}${bindir}/virt-login-shell +} + +EXTRA_OEMESON += " \ + -Dinit_script=${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd','none', d)} \ + -Drunstatedir=/run \ + -Dtests=enabled \ + " + +# gcc9 end up mis-compiling qemuxml2argvtest.o with Og which then +# crashes on target, so remove -Og and use -O2 as workaround +SELECTED_OPTIMIZATION:remove:virtclass-multilib-lib32:mipsarch = "-Og" +SELECTED_OPTIMIZATION:append:virtclass-multilib-lib32:mipsarch = " -O2" + +pkg_postinst:${PN}() { + if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then + /etc/init.d/populate-volatile.sh update + fi + mkdir -m 711 -p $D/data/images +} + +python () { + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") +} -- cgit v1.2.3-54-g00ecf