Re: [PATCH v4] libvirt: uprev v6.3 -> v7.2


Martin Jansa
 

On Thu, Apr 22, 2021 at 3:49 PM Xu, Yanfei <yanfei.xu@...> wrote:
From: Yanfei Xu <yanfei.xu@...>

This upgrade spans 9 small release. The detailed realese logs could
refer to: https://gitlab.com/libvirt/libvirt/-/blob/master/NEWS.rst

Libvirt's buildsystem has changed to meson, So this upgrade drop some
obsolete patches applied to makefile.
 
...

diff --git a/recipes-extended/libvirt/libvirt_6.3.0.bb b/recipes-extended/libvirt/libvirt_7.2.0.bb
similarity index 61%
rename from recipes-extended/libvirt/libvirt_6.3.0.bb
rename to recipes-extended/libvirt/libvirt_7.2.0.bb
index eeb1bf8..24748ef 100644
--- a/recipes-extended/libvirt/libvirt_6.3.0.bb
+++ b/recipes-extended/libvirt/libvirt_7.2.0.bb

... 

-inherit autotools gettext update-rc.d pkgconfig ptest systemd useradd perlnative
+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"

... 

 do_install_prepend() {
@@ -278,6 +198,8 @@ do_install_append() {
        fi

        if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+            mkdir -p ${D}/lib
+            mv ${D}/usr/lib/systemd ${D}/lib
            # This variable is used by libvirtd.service to start libvirtd in the right mode
            sed -i '/#LIBVIRTD_ARGS="--listen"/a LIBVIRTD_ARGS="--listen --daemon"' ${D}/${sysconfdir}/sysconfig/libvirtd

@@ -285,6 +207,8 @@ do_install_append() {
            sed -i -e 's/Type=notify/Type=forking/' \
                   -e '/Type=forking/a PIDFile=/run/libvirtd.pid' \
                   ${D}/${systemd_unitdir}/system/libvirtd.service
+       else
+           rm -rf ${D}/usr/lib/systemd
        fi

        # The /run/libvirt directories created by the Makefile are
@@ -360,7 +284,7 @@ do_install_append() {
            # 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 ${WORKDIR}/gnutls-helper.py ${D}/${bindir}
+            install -m 0755 ${WORKDIR}/gnutls-helper.py ${D}/${bindir}
            install -m 0644 ${WORKDIR}/cakey.pem ${D}/${sysconfdir}/pki/libvirt/private/cakey.pem
            install -m 0644 ${WORKDIR}/cacert.pem ${D}/${sysconfdir}/pki/CA/cacert.pem
            install -m 0644 ${WORKDIR}/serverkey.pem ${D}/${sysconfdir}/pki/libvirt/private/serverkey.pem
@@ -376,10 +300,10 @@ do_install_append() {
        chmod 4755 ${D}${bindir}/virt-login-shell
 }

-EXTRA_OECONF += " \
-    --with-init-script=systemd \
-    --with-test-suite \
-    --with-runstatedir=/run \
+EXTRA_OEMESON += " \
+    -Dinit_script=systemd \
+    -Drunstatedir=/run \
+    -Dtests=enabled \
     "

 # gcc9 end up mis-compiling qemuxml2argvtest.o with Og which then
@@ -387,25 +311,6 @@ EXTRA_OECONF += " \
 SELECTED_OPTIMIZATION_remove_virtclass-multilib-lib32_mipsarch = "-Og"
 SELECTED_OPTIMIZATION_append_virtclass-multilib-lib32_mipsarch = " -O2"

-EXTRA_OEMAKE = "BUILD_DIR=${B} DEST_DIR=${D}${PTEST_PATH} PTEST_DIR=${PTEST_PATH} SYSTEMD_UNIT_DIR=${systemd_system_unitdir}"

Can we set something like SYSTEMD_UNIT_DIR for meson to install service file into correct directory directly (while respecting usrmerge in DISTRO_FEATURES), instead of moving the files in do_install_append?

The sed in do_install_append is failing as shown in:
because ${D}/${systemd_unitdir}/system isn't the same as ${D}/lib/systemd/system with usrmerge:
env.libvirt-without-usrmerge:export systemd_unitdir="/lib/systemd"
env.libvirt-with-usrmerge:export systemd_unitdir="/usr/lib/systemd"

env.libvirt-without-usrmerge:export systemd_system_unitdir="/lib/systemd/system"
env.libvirt-with-usrmerge:export systemd_system_unitdir="/usr/lib/systemd/system"

Join meta-virtualization@lists.yoctoproject.org to automatically receive all group messages.