[-- Attachment #1: Type: text/plain, Size: 2431 bytes --] Hello Guix! This is a patch series that updates libvirt to 7.1.0, now using the meson build system, and then updates a few dependent packages as well. Getting libvirt to build and then work properly was quite tedious, given that we have to build it so that the binaries refer to /etc and /var at runtime, while we set the prefix to the package output. This was relatively straight-forward with the old build system, but with meson I ended up having to patch meson.build so that: - It allows for localstatedir to not be relative to the prefix. And prevent it from trying to create empty directories in /var during installation. - It allows installing configurations, in /gnu/...-libvirt-7.1.0/etc/, but still refer to the system /etc at runtime. An alternative would be to not do any of the installation steps for /etc files, but doing that was more intrusive a change to the build system, and having those configurations installed could be useful examples, or referred to be services. Other than that, the rest is pretty straight-forward. I've tested this using the libvirt service and virt-manager, making sure I could still boot a VM. It's all working fine for me, although my use-case is quite simple, just the defaults: --8<---------------cut here---------------start------------->8--- (services (cons* (service libvirt-service-type (libvirt-configuration (unix-sock-group "libvirt"))) ...)) --8<---------------cut here---------------end--------------->8--- Let me know what you think and if that's good enough to apply! The definition is a bit more hacky than I'd like, so any ideas to improve it would be great. Thanks, Pierre Pierre Langlois (4): gnu: libvirt: Update to 7.1.0. gnu: python-libvirt: Update to 7.1.0. gnu: libvirt-glib: Update to 4.0.0. gnu: virt-manager: Update to 3.2.0. gnu/local.mk | 2 +- .../libvirt-create-machine-cgroup.patch | 48 -------- .../libvirt-do-not-create-var-dirs.patch | 30 +++++ gnu/packages/virtualization.scm | 106 ++++++++---------- 4 files changed, 76 insertions(+), 110 deletions(-) delete mode 100644 gnu/packages/patches/libvirt-create-machine-cgroup.patch create mode 100644 gnu/packages/patches/libvirt-do-not-create-var-dirs.patch -- 2.31.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 519 bytes --]
* gnu/packages/virtualization.scm (libvirt): Update to 7.1.0. [source]: Remove libvirt-create-machine-cgroup.patch, add libvirt-do-not-create-var-dirs.patch. [build-system]: Switch to meson-build-system. [arguments]: Use meson-0.55. Adapt #:configure-flags for meson, there is no need for --docdir anymore. Remove fix-BOURNE_SHELL-definition phase. Add fix-sysconfdir-and-localstatedir phase. Adapt disable-broken-tests to meson. [native-inputs]: Add python-docutils and rpcsvc-proto. * gnu/packages/patches/libvirt-create-machine-cgroup.patch: Delete. * gnu/packages/patches/libvirt-do-not-create-var-dirs.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add new patch, remove the other. --- gnu/local.mk | 2 +- .../libvirt-create-machine-cgroup.patch | 48 ------------ .../libvirt-do-not-create-var-dirs.patch | 30 +++++++ gnu/packages/virtualization.scm | 78 ++++++++----------- 4 files changed, 64 insertions(+), 94 deletions(-) delete mode 100644 gnu/packages/patches/libvirt-create-machine-cgroup.patch create mode 100644 gnu/packages/patches/libvirt-do-not-create-var-dirs.patch diff --git a/gnu/local.mk b/gnu/local.mk index 3d4147a879..cd755f5d67 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1257,7 +1257,7 @@ dist_patch_DATA = \ %D%/packages/patches/kdbusaddons-kinit-file-name.patch \ %D%/packages/patches/libffi-3.3-powerpc-fixes.patch \ %D%/packages/patches/libffi-float128-powerpc64le.patch \ - %D%/packages/patches/libvirt-create-machine-cgroup.patch \ + %D%/packages/patches/libvirt-do-not-create-var-dirs.patch \ %D%/packages/patches/libziparchive-add-includes.patch \ %D%/packages/patches/localed-xorg-keyboard.patch \ %D%/packages/patches/kdiagram-Fix-missing-link-libraries.patch \ diff --git a/gnu/packages/patches/libvirt-create-machine-cgroup.patch b/gnu/packages/patches/libvirt-create-machine-cgroup.patch deleted file mode 100644 index 585ac237e1..0000000000 --- a/gnu/packages/patches/libvirt-create-machine-cgroup.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 9ca0b2955edea162b255b428e493cd8ffac52167 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?= - <rosen644835@gmail.com> -Date: Fri, 1 Nov 2019 17:29:00 +0100 -Subject: [PATCH] vircgroup: Ensure /machine group is associated with its - parent. - -Call first virCgroupNew on the parent group virCgroupNewPartition if -it is available on before the creation of the child group. This -ensures that the creation of a first level group on the unified -architecture, as the check at virCgroupV2ParseControllersFile as the -parent file is there. - -Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1760233 ---- - src/util/vircgroup.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c -index b46f20abfd..33c61f2d45 100644 ---- a/src/util/vircgroup.c -+++ b/src/util/vircgroup.c -@@ -855,9 +855,6 @@ virCgroupNewPartition(const char *path, - if (virCgroupSetPartitionSuffix(path, &newPath) < 0) - goto cleanup; - -- if (virCgroupNew(-1, newPath, NULL, controllers, group) < 0) -- goto cleanup; -- - if (STRNEQ(newPath, "/")) { - char *tmp; - parentPath = g_strdup(newPath); -@@ -868,7 +865,12 @@ virCgroupNewPartition(const char *path, - - if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0) - goto cleanup; -+ } - -+ if (virCgroupNew(-1, newPath, parent, controllers, group) < 0) -+ goto cleanup; -+ -+ if (parent) { - if (virCgroupMakeGroup(parent, *group, create, VIR_CGROUP_NONE) < 0) - goto cleanup; - } --- -2.23.0 - diff --git a/gnu/packages/patches/libvirt-do-not-create-var-dirs.patch b/gnu/packages/patches/libvirt-do-not-create-var-dirs.patch new file mode 100644 index 0000000000..640cb1696d --- /dev/null +++ b/gnu/packages/patches/libvirt-do-not-create-var-dirs.patch @@ -0,0 +1,30 @@ +We define localstatedir as /var, and so we shouldn't be installing empty +directories there. + +diff --git a/src/meson.build b/src/meson.build +index f13b85b74e..58040f2c5d 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -893,22 +893,6 @@ if conf.has('WITH_DTRACE_PROBES') + ) + endif + +- +-# Install empty directories +- +-virt_install_dirs += [ +- localstatedir / 'cache' / 'libvirt', +- localstatedir / 'lib' / 'libvirt' / 'images', +- localstatedir / 'lib' / 'libvirt' / 'filesystems', +- localstatedir / 'lib' / 'libvirt' / 'boot', +-] +- +-meson.add_install_script( +- meson_python_prog.path(), python3_prog.path(), meson_install_dirs_prog.path(), +- virt_install_dirs, +-) +- +- + # Check driver files + + if host_machine.system() == 'linux' diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index fabac5b984..86a95b77f1 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -18,6 +18,7 @@ ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org> ;;; Copyright © 2021 Leo Famulari <leo@famulari.name> +;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -1065,64 +1066,49 @@ manage system or application containers.") (define-public libvirt (package (name "libvirt") - (version "5.8.0") + (version "7.1.0") (source (origin (method url-fetch) (uri (string-append "https://libvirt.org/sources/libvirt-" version ".tar.xz")) (sha256 - (base32 "0m8cqaqflvys5kaqpvb0qr4k365j09jc5xk6x70yvg8qkcl2hcz2")) + (base32 "0v50ckf56h6jd9bmqwp0lh2cmb7qqjmcb6y3mz2i2r15h06ih3w7")) (patches - (search-patches "libvirt-create-machine-cgroup.patch")))) - (build-system gnu-build-system) + (search-patches "libvirt-do-not-create-var-dirs.patch")))) + (build-system meson-build-system) (arguments - `(#:configure-flags - (list "--with-qemu" - "--with-qemu-user=nobody" - "--with-qemu-group=kvm" - "--with-polkit" - (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/" - ,name "-" ,version) - "--sysconfdir=/etc" - "--localstatedir=/var") + `(#:meson ,meson-0.55 ;; libvirt requires meson 0.54 or higher. + #:configure-flags + (list "-Ddriver_qemu=enabled" + "-Dqemu_user=nobody" + "-Dqemu_group=kvm" + "-Dpolkit=enabled") #:phases (modify-phases %standard-phases - (add-before 'configure 'fix-BOURNE_SHELL-definition - ;; BOURNE_SHELL is hard-#defined to ‘/bin/sh’, causing test failures. + (add-after 'unpack 'fix-sysconfdir-and-localstatedir (lambda _ - (substitute* "config.h.in" - (("/bin/sh") (which "sh"))) - #t)) - (add-before 'configure 'patch-libtirpc-file-names - (lambda* (#:key inputs #:allow-other-keys) - ;; libvirt uses an m4 macro instead of pkg-config to determine where - ;; the RPC headers are located. Tell it to look in the right place. - (substitute* "configure" - (("/usr/include/tirpc") ;defined in m4/virt-xdr.m4 - (string-append (assoc-ref inputs "libtirpc") - "/include/tirpc"))) + (substitute* "meson.build" + ;; We set the prefix to be the package output, but we need + ;; localstatedir to be /var. Sadly the build system doesn't + ;; seem to allow that easily. + (("localstatedir = prefix / get_option\\('localstatedir'\\)") + "localstatedir = get_option('localstatedir')") + ;; On the other hand, we keep sysconfdir using the prefix so + ;; that we install configuration files in the package output. + ;; However, we need to make sure the C code refers to /etc via + ;; SYSCONFDIR, and not the read-only configuration in the + ;; package output. + (("set_quoted\\('SYSCONFDIR', sysconfdir\\)") + "set_quoted('SYSCONFDIR', '/etc')")) #t)) (add-before 'configure 'disable-broken-tests (lambda _ - (let ((tests (list "commandtest" ; hangs idly - "qemuxml2argvtest" ; fails - "qemuhotplugtest" ; fails - "virnetsockettest" ; tries to network - "virshtest"))) ; fails - (substitute* "tests/Makefile.in" - (((format #f "(~a)\\$\\(EXEEXT\\)" (string-join tests "|"))) - "")) - #t))) - (replace 'install - ;; Since the sysconfdir and localstatedir should be /etc and /var - ;; at runtime, we must prevent writing to them at installation - ;; time. - (lambda* (#:key make-flags #:allow-other-keys) - (apply invoke "make" "install" - "sysconfdir=/tmp/etc" - "localstatedir=/tmp/var" - make-flags)))))) + (substitute* "tests/meson.build" + (("\\{ 'name': 'commandtest'.*") "") ; hangs idly + (("\\{ 'name': 'qemuxml2argvtest'.*") "") ; fails + (("\\{ 'name': 'virnetsockettest'.*") "")) ; tries to network + #t))))) (inputs `(("libxml2" ,libxml2) ("eudev" ,eudev) @@ -1149,7 +1135,9 @@ manage system or application containers.") ("perl" ,perl) ("pkg-config" ,pkg-config) ("polkit" ,polkit) - ("python" ,python-wrapper))) + ("python" ,python-wrapper) + ("python-docutils" ,python-docutils) ;for rst2html + ("rpcsvc-proto" ,rpcsvc-proto))) ;for 'rpcgen' (home-page "https://libvirt.org") (synopsis "Simple API for virtualization") (description "Libvirt is a C toolkit to interact with the virtualization -- 2.31.0
* gnu/packages/virtualization.scm (python-libvirt): Update to 7.1.0. --- gnu/packages/virtualization.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 86a95b77f1..399cfb544a 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -1191,14 +1191,14 @@ three libraries: (define-public python-libvirt (package (name "python-libvirt") - (version "5.8.0") + (version "7.1.0") (source (origin (method url-fetch) (uri (string-append "https://libvirt.org/sources/python/libvirt-python-" version ".tar.gz")) (sha256 - (base32 "0kyz3lx49d8p75mvbzinxc1zgs8g7adn77y9bm15b8b4ad9zl5s6")))) + (base32 "0dq0qn0xx5hflaq5apj5pm79ba0wcl3w0j9klx8bg73z80gd7bzs")))) (build-system python-build-system) (arguments `(#:phases -- 2.31.0
* gnu/packages/virtualization.scm (libvirt-glib): Update to 4.0.0. [build-system]: Switch to meson-build-system. --- gnu/packages/virtualization.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 399cfb544a..97ca1fa0c8 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -1149,15 +1149,15 @@ to integrate other virtualization mechanisms if needed.") (define-public libvirt-glib (package (name "libvirt-glib") - (version "3.0.0") + (version "4.0.0") (source (origin (method url-fetch) (uri (string-append "ftp://libvirt.org/libvirt/glib/" - "libvirt-glib-" version ".tar.gz")) + "libvirt-glib-" version ".tar.xz")) (sha256 (base32 - "1zpbv4ninc57c9rw4zmmkvvqn7154iv1qfr20kyxn8xplalqrzvz")))) - (build-system gnu-build-system) + "1gdcvqz88qkp402zra9csc6391f2xki1270x683n6ixakl3gf8w4")))) + (build-system meson-build-system) (inputs `(("openssl" ,openssl) ("cyrus-sasl" ,cyrus-sasl) -- 2.31.0
* gnu/packages/virtualization.scm (virt-manager): Update to 3.2.0. [arguments]: Remove #:test-target. Remove fix-qemu-img-reference phase. Adapt check phase to use pytest, although they still do not run. [native-inputs]: Add python-docutils. Suggest adding python-pytest to enable tests. --- gnu/packages/virtualization.scm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 97ca1fa0c8..1df559aa5a 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -1230,7 +1230,7 @@ virtualization library.") (define-public virt-manager (package (name "virt-manager") - (version "2.2.1") + (version "3.2.0") (source (origin (method url-fetch) (uri (string-append "https://virt-manager.org/download/sources" @@ -1238,11 +1238,10 @@ virtualization library.") version ".tar.gz")) (sha256 (base32 - "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g")))) + "11kvpzcmyir91qz0dsnk7748jbb4wr8mrc744w117qc91pcy6vrb")))) (build-system python-build-system) (arguments `(#:use-setuptools? #f ; uses custom distutils 'install' command - #:test-target "test_ui" #:tests? #f ; TODO The tests currently fail ; RuntimeError: Loop condition wasn't ; met @@ -1260,12 +1259,6 @@ virtualization library.") (substitute* "virtinst/buildconfig.py" (("/usr") (assoc-ref outputs "out"))) #t)) - (add-after 'unpack 'fix-qemu-img-reference - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "virtconv/formats.py" - (("/usr(/bin/qemu-img)" _ suffix) - (string-append (assoc-ref inputs "qemu") suffix))) - #t)) (add-after 'unpack 'fix-default-uri (lambda* (#:key inputs #:allow-other-keys) ;; Xen is not available for now - so only patch qemu. @@ -1296,11 +1289,12 @@ virtualization library.") (lambda* (#:key tests? #:allow-other-keys) (when tests? (setenv "HOME" "/tmp") + (setenv "XDG_CACHE_HOME" "/tmp") (system "Xvfb :1 &") (setenv "DISPLAY" ":1") ;; Dogtail requires that Assistive Technology support be enabled (setenv "GTK_MODULES" "gail:atk-bridge") - (invoke "dbus-run-session" "--" "python" "setup.py" "test_ui")) + (invoke "dbus-run-session" "--" "pytest" "--uitests")) #t)) (add-after 'install 'glib-or-gtk-compile-schemas (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas)) @@ -1330,7 +1324,9 @@ virtualization library.") ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache ("perl" ,perl) ; pod2man ("intltool" ,intltool) + ("rst2man" ,python-docutils) ;; The following are required for running the tests + ;; ("python-pytest" ,python-pytest) ;; ("python-dogtail" ,python-dogtail) ;; ("xvfb" ,xorg-server-for-tests) ;; ("dbus" ,dbus) -- 2.31.0
[-- Attachment #1: Type: text/plain, Size: 1450 bytes --] Pierre Langlois writes: > Hello Guix! > > This is a patch series that updates libvirt to 7.1.0, now using the > meson build system, and then updates a few dependent packages as well. > > Getting libvirt to build and then work properly was quite tedious, given > that we have to build it so that the binaries refer to /etc and /var at > runtime, while we set the prefix to the package output. This was > relatively straight-forward with the old build system, but with meson I > ended up having to patch meson.build so that: > > - It allows for localstatedir to not be relative to the prefix. And > prevent it from trying to create empty directories in /var during > installation. > > - It allows installing configurations, in /gnu/...-libvirt-7.1.0/etc/, > but still refer to the system /etc at runtime. An alternative would > be to not do any of the installation steps for /etc files, but doing > that was more intrusive a change to the build system, and having > those configurations installed could be useful examples, or referred > to be services. > > Other than that, the rest is pretty straight-forward. I've tested this > using the libvirt service and virt-manager, making sure I could still > boot a VM. It's all working fine for me, although my use-case is quite > simple, just the defaults: Just after sending this, I realized we actually had a system test for the libvirt service, that works too :-). [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 519 bytes --]
Hi Pierre,
Pierre Langlois <pierre.langlois@gmx.com> skribis:
> This is a patch series that updates libvirt to 7.1.0, now using the
> meson build system, and then updates a few dependent packages as well.
>
> Getting libvirt to build and then work properly was quite tedious, given
> that we have to build it so that the binaries refer to /etc and /var at
> runtime, while we set the prefix to the package output. This was
> relatively straight-forward with the old build system, but with meson I
> ended up having to patch meson.build so that:
>
> - It allows for localstatedir to not be relative to the prefix. And
> prevent it from trying to create empty directories in /var during
> installation.
>
> - It allows installing configurations, in /gnu/...-libvirt-7.1.0/etc/,
> but still refer to the system /etc at runtime. An alternative would
> be to not do any of the installation steps for /etc files, but doing
> that was more intrusive a change to the build system, and having
> those configurations installed could be useful examples, or referred
> to be services.
>
> Other than that, the rest is pretty straight-forward. I've tested this
> using the libvirt service and virt-manager, making sure I could still
> boot a VM. It's all working fine for me, although my use-case is quite
> simple, just the defaults:
>
> (services (cons*
> (service libvirt-service-type
> (libvirt-configuration
> (unix-sock-group "libvirt")))
> ...))
>
> Let me know what you think and if that's good enough to apply! The
> definition is a bit more hacky than I'd like, so any ideas to improve it
> would be great.
AFAICS it all works like a charm, including the system test :-), so I
went ahead and applied the whole series.
Thank you!
Ludo’.