From 82cf6dd0a363f3acee08ec7cf56897bb274eccc4 Mon Sep 17 00:00:00 2001 From: Matteo Bernardini Date: Sat, 3 Apr 2021 07:48:41 +0200 Subject: [PATCH] libraries/libvirt: Updated for version 7.2.0, switch to meson. Signed-off-by: Matteo Bernardini --- libraries/libvirt/README | 16 +++++- libraries/libvirt/libvirt.SlackBuild | 77 ++++++++++++++++++---------- libraries/libvirt/libvirt.info | 8 +-- libraries/libvirt/rc.libvirt | 35 +++++++------ 4 files changed, 87 insertions(+), 49 deletions(-) diff --git a/libraries/libvirt/README b/libraries/libvirt/README index 865d1a545d..471c913f8e 100644 --- a/libraries/libvirt/README +++ b/libraries/libvirt/README @@ -47,7 +47,21 @@ Have a look at the commented part of rc.libvirt for some gotchas. netcat-openbsd is an optional dependency (needed if you want to connect from a remote host using virt-manager). Other optional dependencies include avahi, xen, audit, glusterfs, -and numactl. +numactl, open-iscsi and libiscsi. As of the 4.5.0 version, you may have to remove any previously installed versions of libvirt before this will build. + +Note also that sometimes, in consequence of a major-version upgrade, +you might discover that the libvirt configuration is in an inconsistent +state (machine networking broken and so on) and when this happens you +might want to consider starting from a clean state. To do this: +- backup the existing vms files and their configurations too (with + "virsh dumpxml $name > ${name}.xml) +- remove libvirt +- delete all the system directories (/var/lib/libvirt, /var/log/libvirt, + /etc/libvirt) +- install the new libvirt package, logout and login again (might help) + and start the daemon +- recreate your configurations (network and so on) +- reimport the vms xml backups (with "virsh define ${name}.xml") diff --git a/libraries/libvirt/libvirt.SlackBuild b/libraries/libvirt/libvirt.SlackBuild index 84008caff4..be0f585016 100644 --- a/libraries/libvirt/libvirt.SlackBuild +++ b/libraries/libvirt/libvirt.SlackBuild @@ -5,8 +5,8 @@ # Maintained by Robby Workman PRGNAM=libvirt -VERSION=${VERSION:-4.5.0} -BUILD=${BUILD:-2} +VERSION=${VERSION:-7.2.0} +BUILD=${BUILD:-1} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -35,6 +35,13 @@ fi VIRTGROUP=${VIRTGROUP:-users} +# Some optional dependencies checks +audit="dis" ; if pkg-config --exists audit ; then audit="en" ; fi +bash_completion="" ; if pkg-config --exists bash_completion ; then + bash_completion="-Dbash_completion=enabled -Dbash_completion_dir=/etc/bash_completion.d" +fi +libiscsi="dis" ; if pkg-config --exists libiscsi ; then libiscsi="en" ; fi + set -e rm -rf $PKG @@ -51,38 +58,52 @@ find -L . \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; # we have sysctld files in /etc/sysctl.d -sed -i "s|(prefix)/lib/sysctl|(sysconfdir)/sysctl|" src/Makefile.in +sed -i "s|prefix / 'lib' / 'sysctl.d'|sysconfdir / 'sysctl.d'|" src/remote/meson.build patch -p1 < $CWD/use-virtgroup-in-polkit-rules.diff sed -i -e "s,@VIRTGROUP@,$VIRTGROUP,g" src/remote/libvirtd.rules -CFLAGS="$SLKCFLAGS" \ -./configure \ - --prefix=/usr \ - --libdir=/usr/lib${LIBDIRSUFFIX} \ - --bindir=/usr/sbin \ - --sbindir=/usr/sbin \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --mandir=/usr/man \ - --docdir=/usr/doc/$PRGNAM-$VERSION \ - --enable-static=no \ - --enable-shared=yes \ - --with-yajl \ - --with-qemu-group=$VIRTGROUP \ - --with-init-script=none - -make \ - HTML_DIR=/usr/doc/$PRGNAM-$VERSION \ - EXAMPLE_DIR=/usr/doc/$PRGNAM-$VERSION/examples -make \ - HTML_DIR=/usr/doc/$PRGNAM-$VERSION \ - EXAMPLE_DIR=/usr/doc/$PRGNAM-$VERSION/examples \ - install-strip DESTDIR=$PKG +# Since 5.10: "configure: error: Build directory must be different from source directory" +mkdir -p build +cd build + CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + meson .. \ + --buildtype=release \ + --infodir=/usr/info \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --localstatedir=/var \ + --mandir=/usr/man \ + --prefix=/usr \ + --sysconfdir=/etc \ + -Dqemu_group=$VIRTGROUP \ + $bash_completion \ + -Daudit=${audit}abled \ + -Dlibiscsi=${libiscsi}abled \ + -Dopenwsman=disabled \ + -Dapparmor=disabled \ + -Dselinux=disabled \ + -Dwireshark_dissector=disabled \ + -Ddriver_bhyve=disabled \ + -Ddriver_hyperv=disabled \ + -Ddriver_libxl=disabled \ + -Ddriver_vz=disabled \ + -Dsecdriver_apparmor=disabled \ + -Dsecdriver_selinux=disabled \ + -Dstorage_sheepdog=disabled \ + -Dstorage_vstorage=disabled \ + -Ddtrace=disabled \ + -Dinit_script=none + ninja + DESTDIR=$PKG ninja install +cd .. # we don't have augeas rm -fr $PKG/usr/share/augeas +# this tree is recreated when starting the daemon +rm -fR $PKG/var/run + # add an rc.libvirt to start/stop/restart the daemon install -D -m 0755 $CWD/rc.libvirt $PKG/etc/rc.d/rc.libvirt.new @@ -109,8 +130,10 @@ find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +mv $PKG/usr/share/doc/$PRGNAM/* $PKG/usr/doc/$PRGNAM-$VERSION/ +rm -fR $PKG/usr/share/doc cp -a \ - AUTHORS ChangeLog COPYING* INSTALL README NEWS examples/polkit/* \ + *.rst COPYING* examples/polkit/* \ $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild diff --git a/libraries/libvirt/libvirt.info b/libraries/libvirt/libvirt.info index f8186d1ad3..70cc623dae 100644 --- a/libraries/libvirt/libvirt.info +++ b/libraries/libvirt/libvirt.info @@ -1,10 +1,10 @@ PRGNAM="libvirt" -VERSION="4.5.0" +VERSION="7.2.0" HOMEPAGE="http://libvirt.org" -DOWNLOAD="https://libvirt.org/sources/libvirt-4.5.0.tar.xz" -MD5SUM="692b2d00907438ed08a68813d3177cd3" +DOWNLOAD="https://libvirt.org/sources/libvirt-7.2.0.tar.xz" +MD5SUM="92044b629216e44adce63224970a54a3" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="yajl urlgrabber" +REQUIRES="yajl" MAINTAINER="Robby Workman" EMAIL="rworkman@slackbuilds.org" diff --git a/libraries/libvirt/rc.libvirt b/libraries/libvirt/rc.libvirt index fb058a7189..31ccfb1b77 100644 --- a/libraries/libvirt/rc.libvirt +++ b/libraries/libvirt/rc.libvirt @@ -11,6 +11,7 @@ # script if this behaviour conflicts with anything else running # on your setup +VIRSH=/usr/bin/virsh MODULES="tun vhost_net" TIMEOUT=${TIMEOUT:-300} LIBVIRTD_PIDFILE="/var/run/libvirt/libvirtd.pid" @@ -22,16 +23,16 @@ VIRTLOCKD_OPTS=${VIRTLOCKD_OPTS:-" -f /etc/libvirt/virtlockd.conf -p $VIRTLOCKD_ guests_reboot() { - for machine in $(/usr/sbin/virsh list --name --state-running | grep -v ^$) ; do - /usr/sbin/virsh reboot $machine + for machine in $($VIRSH list --name --state-running | grep -v ^$) ; do + $VIRSH reboot $machine done } guests_shutdown() { - for machine in $(/usr/sbin/virsh list --name --state-running | grep -v ^$) ; do - /usr/sbin/virsh shutdown $machine & + for machine in $($VIRSH list --name --state-running | grep -v ^$) ; do + $VIRSH shutdown $machine & done sleep 2 @@ -40,7 +41,7 @@ guests_shutdown() { count=0 - while [ $(/usr/sbin/virsh list --name --state-running | grep -v ^$ | wc -l) -gt "0" ]; do + while [ $($VIRSH list --name --state-running | grep -v ^$ | wc -l) -gt "0" ]; do if [ "$count" -ge "$TIMEOUT" ];then break fi @@ -51,11 +52,11 @@ guests_shutdown() { echo "" - if [ $(/usr/sbin/virsh list --name --state-running | grep -v ^$ | wc -l) -gt "0" ];then + if [ $($VIRSH list --name --state-running | grep -v ^$ | wc -l) -gt "0" ];then echo -n "The following guests are still running after $TIMEOUT seconds; destroying them: " - for machine in $(/usr/sbin/virsh list --name --state-running | grep -v ^$) ; do - /usr/sbin/virsh destroy $machine + for machine in $($VIRSH list --name --state-running | grep -v ^$) ; do + $VIRSH destroy $machine echo -n "$machine " done @@ -73,8 +74,8 @@ guests_managedsave() { # apply managedsave on running and paused machines (as we can't distinguish between # the two states while managedsave is being applied, so won't know when to finish waiting) - for machine in $(/usr/sbin/virsh list --name | grep -v ^$) ; do - /usr/sbin/virsh managedsave $machine & + for machine in $($VIRSH list --name | grep -v ^$) ; do + $VIRSH managedsave $machine & done sleep 2 @@ -83,7 +84,7 @@ guests_managedsave() { count=0 - while [ $(/usr/sbin/virsh list --name | grep -v ^$ | wc -l) -gt "0" ]; do + while [ $($VIRSH list --name | grep -v ^$ | wc -l) -gt "0" ]; do if [ "$count" -ge "$TIMEOUT" ];then break fi @@ -94,11 +95,11 @@ guests_managedsave() { echo "" - if [ $(/usr/sbin/virsh list --name | grep -v ^$ | wc -l) -gt "0" ];then + if [ $($VIRSH list --name | grep -v ^$ | wc -l) -gt "0" ];then echo -n "Following guests are still running after $TIMEOUT seconds, destroying them: " - for machine in $(/usr/sbin/virsh list --name | grep -v ^$) ; do - /usr/sbin/virsh destroy $machine + for machine in $($VIRSH list --name | grep -v ^$) ; do + $VIRSH destroy $machine echo -n "$machine " done @@ -140,7 +141,7 @@ start_libvirtd() { exit 1 fi echo "Starting libvirtd: /usr/sbin/libvirtd -d " - mkdir -p $(dirname $LIBVIRTD_PIDFILE) + mkdir -p $(dirname $LIBVIRTD_PIDFILE) /run/libvirt/{lockd,lxc,network,qemu/swtpm} check_processor /sbin/modprobe -a $MODULES /usr/sbin/libvirtd -d -l $LIBVIRTD_OPTS @@ -154,8 +155,8 @@ stop_libvirtd() { guests_managedsave check_processor echo "Stopping libvirtd..." - for network in $(/usr/sbin/virsh net-list --name); do - /usr/sbin/virsh net-destroy "$network" + for network in $($VIRSH net-list --name); do + $VIRSH net-destroy "$network" done kill -TERM $(cat $LIBVIRTD_PIDFILE) sleep 3