gnu: zfs: Use new package style.

* gnu/packages/file-systems.scm (zfs): Comment style.
[arguments]: Rewrite using gexps.
[inputs]: Remove labels.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Brian Cully 2022-05-12 11:05:16 -04:00 committed by Ludovic Courtès
parent 0b1473e967
commit 7b6818359c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1158,128 +1158,136 @@ (define-public zfs
(base32 "1xmcy4f0damf1pkb1sy1339ir1jkky0dwzd8vhwgc1pqjgac0liv")))) (base32 "1xmcy4f0damf1pkb1sy1339ir1jkky0dwzd8vhwgc1pqjgac0liv"))))
(build-system linux-module-build-system) (build-system linux-module-build-system)
(arguments (arguments
`(;; The ZFS kernel module should not be downloaded since the license (list
;; terms don't allow for distributing it, only building it locally. ;; The ZFS kernel module should not be downloaded since the license
#:substitutable? #f ;; terms don't allow for distributing it, only building it locally.
;; Tests cannot run in an unprivileged build environment. #:substitutable? #f
#:tests? #f ;; Tests cannot run in an unprivileged build environment.
#:phases #:tests? #f
(modify-phases %standard-phases #:phases
(add-after 'configure 'really-configure #~(modify-phases %standard-phases
(lambda* (#:key outputs inputs #:allow-other-keys) (add-after 'configure 'really-configure
(let ((out (assoc-ref outputs "out"))) (lambda* (#:key inputs #:allow-other-keys)
(substitute* "configure" (substitute* "configure"
(("-/bin/sh") (string-append "-" (which "sh")))) (("-/bin/sh") (string-append "-" (which "sh"))))
(invoke "./configure" (invoke "./configure"
"--with-config=all" "--with-config=all"
(string-append "--prefix=" out) (string-append "--prefix=" #$output)
(string-append "--with-dracutdir=" out "/lib/dracut") (string-append "--with-dracutdir=" #$output
(string-append "--with-udevdir=" out "/lib/udev") "/lib/dracut")
(string-append "--with-mounthelperdir=" out "/sbin") (string-append "--with-udevdir=" #$output
(string-append "--with-linux=" "/lib/udev")
(assoc-ref inputs "linux-module-builder") (string-append "--with-mounthelperdir=" #$output
"/lib/modules/build"))))) "/sbin")
(add-after 'unpack 'patch-source (string-append "--with-linux="
(lambda* (#:key inputs outputs #:allow-other-keys) (search-input-directory
(let ((out (assoc-ref outputs "out")) inputs
(src (assoc-ref outputs "src")) "lib/modules/build")))))
(util-linux (assoc-ref inputs "util-linux")) (add-after 'unpack 'patch-source
(nfs-utils (assoc-ref inputs "nfs-utils")) (lambda* (#:key inputs #:allow-other-keys)
(kmod (assoc-ref inputs "kmod-runtime"))) ;; New feature "compatibility=" in 2.1.0.
;; New feature "compatibility=" in 2.1.0. ;; This feature looks up in two locations:
;; This feature looks up in two locations: ;; /etc/zfs/compatibility.d/
;; /etc/zfs/compatibility.d/ ;; /usr/share/zfs/compatibility.d/
;; /usr/share/zfs/compatibility.d/ ;; The first is intended for system-specific compatibility
;; The first is intended for system-specific compatibility ;; sets, while the second is what is installed with the
;; sets, while the second is what is installed with the ;; OpenZFS package, so use the absolute path for the first
;; OpenZFS package, so use the absolute path for the first ;; (which requires patching in the file) and the store path
;; (which requires patching in the file) and the store path ;; for the second (which it gets by default).
;; for the second (which it gets by default). (substitute* "include/sys/fs/zfs.h"
(substitute* "include/sys/fs/zfs.h" (("#define\tZPOOL_SYSCONF_COMPAT_D.*$")
(("#define\tZPOOL_SYSCONF_COMPAT_D.*$") ;; Use absolute path.
; Use absolute path. "#define\tZPOOL_SYSCONF_COMPAT_D\t\"/etc/zfs/compatibility.d\"\n"))
"#define\tZPOOL_SYSCONF_COMPAT_D\t\"/etc/zfs/compatibility.d\"\n")) ;; Also update the manual, which uses absolute paths, so that
;; Also update the manual, which uses absolute paths, so that ;; /usr/share/zfs/compatibility.d/ is referred via the store.
;; /usr/share/zfs/compatibility.d/ is referred via the store. (substitute* '("man/man7/zpoolprops.7"
(substitute* '("man/man7/zpoolprops.7" "man/man7/zpool-features.7")
"man/man7/zpool-features.7") (("/usr/share/zfs/compatibility.d")
(("/usr/share/zfs/compatibility.d") (string-append #$output "/share/zfs/compatibility.d")))
(string-append out "/share/zfs/compatibility.d"))) (substitute* "etc/Makefile.in"
(substitute* "etc/Makefile.in" ;; This just contains an example configuration file for
;; This just contains an example configuration file for ;; configuring ZFS on traditional init systems, skip it
;; configuring ZFS on traditional init systems, skip it ;; since we cannot use it anyway; the install target becomes
;; since we cannot use it anyway; the install target becomes ;; misdirected.
;; misdirected. (("= default ") "= "))
(("= default ") "= ")) (substitute* "lib/libzfs/os/linux/libzfs_util_os.c"
(substitute* "lib/libzfs/os/linux/libzfs_util_os.c" ;; Use path to /gnu/store/*-kmod in actual path that is
;; Use path to /gnu/store/*-kmod in actual path that is exec'ed. ;; exec'ed.
(("\"/sbin/modprobe\"") (("\"/sbin/modprobe\"")
(string-append "\"" kmod "/bin/modprobe" "\"")) (string-append "\""
;; Just use 'modprobe' in message to user, since Guix (search-input-file inputs "/bin/modprobe")
;; does not have a traditional /sbin/ "\""))
(("'/sbin/modprobe ") "'modprobe ")) ;; Just use 'modprobe' in message to user, since Guix
(substitute* "contrib/Makefile.in" ;; does not have a traditional /sbin/
;; This is not configurable nor is its hard-coded /usr prefix. (("'/sbin/modprobe ") "'modprobe "))
((" initramfs") "")) (substitute* "contrib/Makefile.in"
(substitute* "module/os/linux/zfs/zfs_ctldir.c" ;; This is not configurable nor is its hard-coded /usr prefix.
(("/usr/bin/env\", \"umount") ((" initramfs") ""))
(string-append util-linux "/bin/umount\", \"-n")) (substitute* "module/os/linux/zfs/zfs_ctldir.c"
(("/usr/bin/env\", \"mount") (("/usr/bin/env\", \"umount")
(string-append util-linux "/bin/mount\", \"-n"))) (string-append (search-input-file inputs "/bin/umount")
(substitute* "lib/libzfs/os/linux/libzfs_mount_os.c" "\", \"-n"))
(("/bin/mount") (string-append util-linux "/bin/mount")) (("/usr/bin/env\", \"mount")
(("/bin/umount") (string-append util-linux "/bin/umount"))) (string-append (search-input-file inputs "/bin/mount")
(substitute* "lib/libshare/os/linux/nfs.c" "\", \"-n")))
(("/usr/sbin/exportfs") (substitute* "lib/libzfs/os/linux/libzfs_mount_os.c"
(string-append nfs-utils "/sbin/exportfs"))) (("/bin/mount") (search-input-file inputs "/bin/mount"))
(substitute* "config/zfs-build.m4" (("/bin/umount") (search-input-file inputs "/bin/umount")))
(("\\$sysconfdir/init.d") (string-append out "/etc/init.d"))) (substitute* "lib/libshare/os/linux/nfs.c"
(substitute* '("etc/zfs/Makefile.am" (("/usr/sbin/exportfs")
"cmd/zed/Makefile.am") (search-input-file inputs "/sbin/exportfs")))
(("\\$\\(sysconfdir)") (string-append out "/etc"))) (substitute* "config/zfs-build.m4"
(substitute* "cmd/vdev_id/vdev_id" (("\\$sysconfdir/init.d")
(("PATH=/bin:/sbin:/usr/bin:/usr/sbin") (string-append #$output "/etc/init.d")))
(string-append "PATH=" (substitute* '("etc/zfs/Makefile.am"
(dirname (which "chmod")) ":" "cmd/zed/Makefile.am")
(dirname (which "grep")) ":" (("\\$\\(sysconfdir)") (string-append #$output "/etc")))
(dirname (which "sed")) ":" (substitute* "cmd/vdev_id/vdev_id"
(dirname (which "gawk"))))) (("PATH=/bin:/sbin:/usr/bin:/usr/sbin")
(substitute* "contrib/pyzfs/Makefile.in" (string-append "PATH="
((".*install-lib.*") "")) (dirname (which "chmod")) ":"
(substitute* '("Makefile.am" "Makefile.in") (dirname (which "grep")) ":"
(("\\$\\(prefix)/src") (string-append src "/src"))) (dirname (which "sed")) ":"
(substitute* (find-files "udev/rules.d/" ".rules.in$") (dirname (which "gawk")))))
(("/sbin/modprobe") (string-append kmod "/bin/modprobe")))))) (substitute* "contrib/pyzfs/Makefile.in"
(replace 'build ((".*install-lib.*") ""))
(lambda _ (invoke "make"))) (substitute* '("Makefile.am" "Makefile.in")
(replace 'install (("\\$\\(prefix)/src") (string-append #$output:src "/src")))
(lambda* (#:key outputs inputs native-inputs #:allow-other-keys) (substitute* (find-files "udev/rules.d/" ".rules.in$")
(let* ((out (assoc-ref outputs "out")) (("/sbin/modprobe")
(moddir (assoc-ref outputs "module")) (search-input-file inputs "/bin/modprobe")))))
(kmod (assoc-ref (or native-inputs inputs) "kmod"))) (replace 'build
(invoke "make" "install" (lambda _ (invoke "make")))
(string-append "DEFAULT_INITCONF_DIR=" out "/etc/default") (replace 'install
(string-append "DEPMOD=" kmod "/bin/depmod") (lambda* (#:key inputs native-inputs #:allow-other-keys)
(string-append "INSTALL_PATH=" out) (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
(string-append "INSTALL_MOD_PATH=" moddir) (invoke "make" "install"
"INSTALL_MOD_STRIP=1") (string-append "DEFAULT_INITCONF_DIR="
(install-file "contrib/bash_completion.d/zfs" #$output "/etc/default")
(string-append out (string-append "DEPMOD="
"/share/bash-completion/completions")))))))) (search-input-file
(or native-inputs inputs)
"/bin/depmod"))
(string-append "INSTALL_PATH=" #$output)
(string-append "INSTALL_MOD_PATH=" #$output:module)
"INSTALL_MOD_STRIP=1")
(install-file
"contrib/bash_completion.d/zfs"
(string-append #$output
"/share/bash-completion/completions"))))))))
(native-inputs (native-inputs
(list attr kmod pkg-config)) (list attr kmod pkg-config))
(inputs (inputs (list eudev
`(("eudev" ,eudev) kmod
("kmod-runtime" ,kmod) libaio
("libaio" ,libaio) libtirpc
("libtirpc" ,libtirpc) nfs-utils
("nfs-utils" ,nfs-utils) openssl
("openssl" ,openssl) python
("python" ,python) python-cffi
("python-cffi" ,python-cffi) util-linux
("util-linux" ,util-linux) `(,util-linux "lib")
("util-linux:lib" ,util-linux "lib") zlib))
("zlib" ,zlib)))
(home-page "https://zfsonlinux.org/") (home-page "https://zfsonlinux.org/")
(synopsis "OpenZFS on Linux") (synopsis "OpenZFS on Linux")
(description (description