aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-03-05 23:59:24 +0900
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-03-06 00:06:05 +0900
commit4226b784b9e7fd8b4662cd2f8206651f9978bda5 (patch)
treecb9276bce0ea149ec3f9ac61c501bc27a9f1f2fc
parentb9eb832017aed044495a89055991f5c65a838fa3 (diff)
downloadguix-4226b784b9e7fd8b4662cd2f8206651f9978bda5.tar.gz
guix-4226b784b9e7fd8b4662cd2f8206651f9978bda5.zip
gnu: libvirt: Patch nft and other commands.
* gnu/packages/virtualization.scm (libvirt) [arguments] <#:phases>: Rename use-absolute-dnsmasq phase to patch-commands. Extend to patch ebtables, iptables, ip6tables and nft. [inputs]: Remove ebtables; the modern ebtables binary comes from the iptables package. Add nftables. Fixes: bug#76741 Reported-by: Simen Endsjø <contact@simendsjo.me> Change-Id: I481c200a4691eae776bfb188dfbf79870c107bd9
-rw-r--r--gnu/packages/virtualization.scm34
1 files changed, 28 insertions, 6 deletions
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 5c6f88d55f..cb9e973dcc 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -1547,6 +1547,9 @@ pretty simple, REST API.")
(build-system meson-build-system)
(arguments
(list
+ #:modules '((guix build meson-build-system)
+ (guix build utils)
+ (ice-9 format))
#:configure-flags
#~(list "-Ddriver_qemu=enabled"
"-Dqemu_user=nobody"
@@ -1573,12 +1576,31 @@ pretty simple, REST API.")
(substitute* "scripts/meson-install-dirs.py"
(("destdir = .*")
"destdir = '/tmp'"))))
- (add-after 'unpack 'use-absolute-dnsmasq
+ (add-after 'unpack 'patch-commands
(lambda* (#:key inputs #:allow-other-keys)
- (let ((dnsmasq (search-input-file inputs "sbin/dnsmasq")))
- (substitute* "src/util/virdnsmasq.c"
- (("#define DNSMASQ \"dnsmasq\"")
- (string-append "#define DNSMASQ \"" dnsmasq "\""))))))
+ (let-syntax
+ ((patch-command-define
+ ;; Patch lines of the form: #define COMMAND "command"
+ (lambda (x)
+ (syntax-case x ()
+ ((_ file command)
+ (with-syntax ((pattern (datum->syntax x 'pattern)))
+ #'(let ((pattern
+ (format #f "(#define ~:@(~a~) )\"~a\""
+ command command)))
+ (substitute* file
+ ((pattern dummy head)
+ (format
+ #f "~a~s" head
+ (search-input-file
+ inputs (string-append "sbin/"
+ command))))))))))))
+ (with-directory-excursion "src/util"
+ (patch-command-define "virdnsmasq.c" "dnsmasq")
+ (patch-command-define "virfirewall.h" "ebtables")
+ (patch-command-define "virfirewall.h" "iptables")
+ (patch-command-define "virfirewall.h" "ip6tables")
+ (patch-command-define "virfirewall.h" "nft")))))
(add-before 'configure 'disable-broken-tests
(lambda _
(let ((tests (list "commandtest" ; hangs idly
@@ -1601,7 +1623,6 @@ pretty simple, REST API.")
dbus
dmidecode
dnsmasq
- ebtables
eudev
fuse-2
gnutls
@@ -1615,6 +1636,7 @@ pretty simple, REST API.")
libtirpc ;for <rpc/rpc.h>
libxml2
lvm2 ;for libdevmapper
+ nftables
openssl
parted
`(,util-linux "lib")