GNU bug report logs - #71482
[PATCH] gnu: zfs: Split the kernel module out of the base package.

Previous Next

Package: guix-patches;

Reported by: Kaelyn Takata <kaelyn.alexi <at> protonmail.com>

Date: Mon, 10 Jun 2024 17:11:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 71482 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#71482; Package guix-patches. (Mon, 10 Jun 2024 17:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kaelyn Takata <kaelyn.alexi <at> protonmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 10 Jun 2024 17:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
To: guix-patches <at> gnu.org
Cc: Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
Subject: [PATCH] gnu: zfs: Split the kernel module out of the base package.
Date: Mon, 10 Jun 2024 16:45:26 +0000
Split the ZFS user-space tools and kernel modules into separate packages, with
a new make-zfs-for-kernel procedure for easily creating ZFS kernel module
packages for a specific kernel package. The generated kernel module package
includes the kernel version for which it was built in the name of the package,
such as "zfs-for-linux-libre-6.6.32-version".

& gnu/packages/file-systems.scm (zfs): Change to be the user-space tools.
(make-zfs-for-kernel): New procedure which accepts a single 'kernel-package'
argument.

Change-Id: Ib2d0e2b0f031d2ab3105d6b46ecd73bde1aa8564
---
 gnu/packages/file-systems.scm | 124 ++++++++++++++++++++--------------
 1 file changed, 72 insertions(+), 52 deletions(-)

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index fa7da35898..78121c1ec2 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -1444,7 +1444,6 @@ (define-public zfs
   (package
     (name "zfs")
     (version "2.2.4")
-    (outputs '("out" "module" "src"))
     (source
       (origin
         (method url-fetch)
@@ -1453,33 +1452,19 @@ (define-public zfs
                               "/zfs-" version ".tar.gz"))
           (sha256
            (base32 "1h0yqchirzsn2gll1w2gclb13hr8511z67lf85cigm43frgr144p"))))
-    (build-system linux-module-build-system)
+    (build-system gnu-build-system)
     (arguments
      (list
-      ;; The ZFS kernel module should not be downloaded since the license
-      ;; terms don't allow for distributing it, only building it locally.
-      #:substitutable? #f
-      ;; Tests cannot run in an unprivileged build environment.
-      #:tests? #f
+      #:configure-flags #~(list "--with-config=user"
+                                (string-append "--prefix=" #$output)
+                                (string-append "--with-dracutdir=" #$output
+                                               "/lib/dracut")
+                                (string-append "--with-udevdir=" #$output
+                                               "/lib/udev")
+                                (string-append "--with-mounthelperdir=" #$output
+                                               "/sbin"))
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'configure 'really-configure
-            (lambda* (#:key inputs #:allow-other-keys)
-              (substitute* "configure"
-                (("-/bin/sh") (string-append "-" (which "sh"))))
-              (invoke "./configure"
-                      "--with-config=all"
-                      (string-append "--prefix=" #$output)
-                      (string-append "--with-dracutdir=" #$output
-                                     "/lib/dracut")
-                      (string-append "--with-udevdir=" #$output
-                                     "/lib/udev")
-                      (string-append "--with-mounthelperdir=" #$output
-                                     "/sbin")
-                      (string-append "--with-linux="
-                                     (search-input-directory
-                                      inputs
-                                      "lib/modules/build")))))
           (add-after 'unpack 'patch-source
             (lambda* (#:key inputs #:allow-other-keys)
               ;; New feature "compatibility=" in 2.1.0.
@@ -1511,14 +1496,6 @@ (define-public zfs
                 ;; Just use 'modprobe' in message to user, since Guix
                 ;; does not have a traditional /sbin/
                 (("'/sbin/modprobe ") "'modprobe "))
-              (substitute* "configure"
-                (("/etc/default")
-                 (string-append #$output "/etc/default"))
-                (("/etc/bash_completion.d")
-                 (string-append #$output "/etc/bash_completion.d")))
-              (substitute* "Makefile.in"
-                (("/usr/share/initramfs-tools")
-                 (string-append #$output "/usr/share/initramfs-tools")))
               (substitute* "contrib/initramfs/Makefile.am"
                 (("/usr/share/initramfs-tools")
                  (string-append #$output "/usr/share/initramfs-tools")))
@@ -1548,31 +1525,22 @@ (define-public zfs
                                 (dirname (which "sed")) ":"
                                 (dirname (which "gawk")))))
               (substitute* '("Makefile.am" "Makefile.in")
-                (("\\$\\(prefix)/src") (string-append #$output:src "/src")))
+                (("@initconfdir@") (string-append #$output "/etc/default"))
+                (("/usr/share/initramfs-tools" dir) (string-append #$output dir)))
               (substitute* (find-files "udev/rules.d/" ".rules.in$")
                 (("/sbin/modprobe")
                  (search-input-file inputs "/bin/modprobe")))))
-          (replace 'build
-            (lambda _ (invoke "make")))
           (replace 'install
-            (lambda* (#:key inputs native-inputs #:allow-other-keys)
-              (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
-                (invoke "make" "install"
-                        (string-append "DEFAULT_INITCONF_DIR="
-                                       #$output "/etc/default")
-                        (string-append "DEPMOD="
-                                       (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"))))))))
+            (lambda _
+              (invoke "make" "install"
+                      (string-append "DEFAULT_INITCONF_DIR="
+                                     #$output "/etc/default")
+                      (string-append "INSTALL_PATH=" #$output)
+                      (string-append "bashcompletiondir="
+                                     #$output
+                                     "/share/bash-completion/completions")))))))
     (native-inputs
-     (list attr kmod pkg-config))
+     (list attr kmod pkg-config python))
     (inputs (list eudev
                   kmod
                   libaio
@@ -1592,6 +1560,58 @@ (define-public zfs
 community.")
     (license license:cddl1.0)))
 
+(define-public (make-zfs-for-kernel kernel-package)
+  (package
+    (inherit zfs)
+    (name (string-join (list (package-name zfs)
+                             "for"
+                             (package-name kernel-package)
+                             (package-version kernel-package)
+                             "version")
+                       "-"))
+    (build-system linux-module-build-system)
+    (arguments
+     (substitute-keyword-arguments
+         (strip-keyword-arguments '(#:configure-flags)
+                                  (package-arguments zfs))
+       ((#:linux _ #f) kernel-package)
+       ((#:substitutable? _ #t) #f)
+       ((#:phases phases)
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'patch-source
+              (assoc-ref #$phases 'patch-source))
+            (add-after 'configure 'really-configure
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "configure"
+                  (("-/bin/sh") (string-append "-" (which "sh"))))
+                (invoke "./configure"
+                        "--with-config=kernel"
+                        (string-append "--prefix=" #$output)
+                        (string-append "--with-udevdir=" #$output
+                                       "/lib/udev")
+                        (string-append "--with-linux="
+                                       (search-input-directory
+                                        inputs
+                                        "lib/modules/build")))))
+            (replace 'build
+              (lambda* (#:key (make-flags '()) (parallel-build? #t)
+                        #:allow-other-keys)
+                (apply invoke "make"
+                       `(,@(if parallel-build?
+                               `("-j" ,(number->string (parallel-job-count)))
+                               '())
+                         ,@make-flags))))
+            (replace 'install
+              (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
+                  (invoke "make" "-C" "module" "install"
+                          (string-append "DEPMOD="
+                                         (search-input-file
+                                          (or native-inputs inputs)
+                                          "/bin/depmod"))
+                          (string-append "INSTALL_MOD_PATH=" #$output)
+                          "INSTALL_MOD_STRIP=1"))))))))))
+
 (define-public zfs-auto-snapshot
   (package
     (name "zfs-auto-snapshot")

base-commit: df5648daa1a5d097a430131bbff353b865b476b6
-- 
2.45.1






Information forwarded to guix-patches <at> gnu.org:
bug#71482; Package guix-patches. (Sun, 22 Sep 2024 19:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 71482 <at> debbugs.gnu.org (full text, mbox):

From: Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
To: 71482 <at> debbugs.gnu.org
Cc: Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
Subject: [PATCH v2] gnu: zfs: Split the kernel module out of the base package.
Date: Sun, 22 Sep 2024 19:52:02 +0000
Split the ZFS user-space tools and kernel modules into separate packages, with
a new make-zfs-for-kernel procedure for easily creating ZFS kernel module
packages for a specific kernel package. The generated kernel module package
includes the kernel version for which it was built in the name of the package,
such as "zfs-for-linux-libre-6.6.32-version".

& gnu/packages/file-systems.scm (zfs): Change to be the user-space tools.
(make-zfs-for-kernel): New procedure which accepts a single 'kernel-package'
argument.

Change-Id: Ib2d0e2b0f031d2ab3105d6b46ecd73bde1aa8564
---
 gnu/packages/file-systems.scm | 126 ++++++++++++++++++++--------------
 1 file changed, 73 insertions(+), 53 deletions(-)

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index 059bdf67a9..ceaaf7f3ab 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -9,7 +9,7 @@
 ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
 ;;; Copyright © 2021 Stefan Reichör <stefan <at> xsteve.at>
 ;;; Copyright © 2021 Noisytoot <noisytoot <at> disroot.org>
-;;; Copyright © 2021, 2023 Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
+;;; Copyright © 2021, 2023, 2024 Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
 ;;; Copyright © 2022 Brian Cully <bjc <at> spork.org>
 ;;; Copyright © 2023 Aaron Covrig <aaron.covrig.us <at> ieee.org>
 ;;; Copyright © 2024 Ahmad Draidi <a.r.draidi <at> redscript.org>
@@ -1564,7 +1564,6 @@ (define-public zfs
   (package
     (name "zfs")
     (version "2.2.6")
-    (outputs '("out" "module" "src"))
     (source
       (origin
         (method url-fetch)
@@ -1573,33 +1572,19 @@ (define-public zfs
                               "/zfs-" version ".tar.gz"))
           (sha256
            (base32 "19x2a8k25i3y6nr7nx5aaqrpnp55vjmrw86p06zpgpf578804bn9"))))
-    (build-system linux-module-build-system)
+    (build-system gnu-build-system)
     (arguments
      (list
-      ;; The ZFS kernel module should not be downloaded since the license
-      ;; terms don't allow for distributing it, only building it locally.
-      #:substitutable? #f
-      ;; Tests cannot run in an unprivileged build environment.
-      #:tests? #f
+      #:configure-flags #~(list "--with-config=user"
+                                (string-append "--prefix=" #$output)
+                                (string-append "--with-dracutdir=" #$output
+                                               "/lib/dracut")
+                                (string-append "--with-udevdir=" #$output
+                                               "/lib/udev")
+                                (string-append "--with-mounthelperdir=" #$output
+                                               "/sbin"))
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'configure 'really-configure
-            (lambda* (#:key inputs #:allow-other-keys)
-              (substitute* "configure"
-                (("-/bin/sh") (string-append "-" (which "sh"))))
-              (invoke "./configure"
-                      "--with-config=all"
-                      (string-append "--prefix=" #$output)
-                      (string-append "--with-dracutdir=" #$output
-                                     "/lib/dracut")
-                      (string-append "--with-udevdir=" #$output
-                                     "/lib/udev")
-                      (string-append "--with-mounthelperdir=" #$output
-                                     "/sbin")
-                      (string-append "--with-linux="
-                                     (search-input-directory
-                                      inputs
-                                      "lib/modules/build")))))
           (add-after 'unpack 'patch-source
             (lambda* (#:key inputs #:allow-other-keys)
               ;; New feature "compatibility=" in 2.1.0.
@@ -1631,14 +1616,6 @@ (define-public zfs
                 ;; Just use 'modprobe' in message to user, since Guix
                 ;; does not have a traditional /sbin/
                 (("'/sbin/modprobe ") "'modprobe "))
-              (substitute* "configure"
-                (("/etc/default")
-                 (string-append #$output "/etc/default"))
-                (("/etc/bash_completion.d")
-                 (string-append #$output "/etc/bash_completion.d")))
-              (substitute* "Makefile.in"
-                (("/usr/share/initramfs-tools")
-                 (string-append #$output "/usr/share/initramfs-tools")))
               (substitute* "contrib/initramfs/Makefile.am"
                 (("/usr/share/initramfs-tools")
                  (string-append #$output "/usr/share/initramfs-tools")))
@@ -1668,31 +1645,22 @@ (define-public zfs
                                 (dirname (which "sed")) ":"
                                 (dirname (which "gawk")))))
               (substitute* '("Makefile.am" "Makefile.in")
-                (("\\$\\(prefix)/src") (string-append #$output:src "/src")))
+                (("@initconfdir@") (string-append #$output "/etc/default"))
+                (("/usr/share/initramfs-tools" dir) (string-append #$output dir)))
               (substitute* (find-files "udev/rules.d/" ".rules.in$")
                 (("/sbin/modprobe")
                  (search-input-file inputs "/bin/modprobe")))))
-          (replace 'build
-            (lambda _ (invoke "make")))
           (replace 'install
-            (lambda* (#:key inputs native-inputs #:allow-other-keys)
-              (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
-                (invoke "make" "install"
-                        (string-append "DEFAULT_INITCONF_DIR="
-                                       #$output "/etc/default")
-                        (string-append "DEPMOD="
-                                       (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"))))))))
+            (lambda _
+              (invoke "make" "install"
+                      (string-append "DEFAULT_INITCONF_DIR="
+                                     #$output "/etc/default")
+                      (string-append "INSTALL_PATH=" #$output)
+                      (string-append "bashcompletiondir="
+                                     #$output
+                                     "/share/bash-completion/completions")))))))
     (native-inputs
-     (list attr kmod pkg-config))
+     (list attr kmod pkg-config python))
     (inputs (list eudev
                   kmod
                   libaio
@@ -1712,6 +1680,58 @@ (define-public zfs
 community.")
     (license license:cddl1.0)))
 
+(define-public (make-zfs-for-kernel kernel-package)
+  (package
+    (inherit zfs)
+    (name (string-join (list (package-name zfs)
+                             "for"
+                             (package-name kernel-package)
+                             (package-version kernel-package)
+                             "version")
+                       "-"))
+    (build-system linux-module-build-system)
+    (arguments
+     (substitute-keyword-arguments
+         (strip-keyword-arguments '(#:configure-flags)
+                                  (package-arguments zfs))
+       ((#:linux _ #f) kernel-package)
+       ((#:substitutable? _ #t) #f)
+       ((#:phases phases)
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'patch-source
+              (assoc-ref #$phases 'patch-source))
+            (add-after 'configure 'really-configure
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "configure"
+                  (("-/bin/sh") (string-append "-" (which "sh"))))
+                (invoke "./configure"
+                        "--with-config=kernel"
+                        (string-append "--prefix=" #$output)
+                        (string-append "--with-udevdir=" #$output
+                                       "/lib/udev")
+                        (string-append "--with-linux="
+                                       (search-input-directory
+                                        inputs
+                                        "lib/modules/build")))))
+            (replace 'build
+              (lambda* (#:key (make-flags '()) (parallel-build? #t)
+                        #:allow-other-keys)
+                (apply invoke "make"
+                       `(,@(if parallel-build?
+                               `("-j" ,(number->string (parallel-job-count)))
+                               '())
+                         ,@make-flags))))
+            (replace 'install
+              (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
+                  (invoke "make" "-C" "module" "install"
+                          (string-append "DEPMOD="
+                                         (search-input-file
+                                          (or native-inputs inputs)
+                                          "/bin/depmod"))
+                          (string-append "INSTALL_MOD_PATH=" #$output)
+                          "INSTALL_MOD_STRIP=1"))))))))))
+
 (define-public zfs-auto-snapshot
   (package
     (name "zfs-auto-snapshot")

base-commit: b7c94d528875415ea7ec6225d88a6b3d55fa2e14
-- 
2.46.0






Information forwarded to guix-patches <at> gnu.org:
bug#71482; Package guix-patches. (Sat, 05 Oct 2024 16:19:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>
To: Kaelyn Takata via Guix-patches via <guix-patches <at> gnu.org>
Cc: Kaelyn Takata <kaelyn.alexi <at> protonmail.com>, 71482 <at> debbugs.gnu.org
Subject: Re: [bug#71482] [PATCH v2] gnu: zfs: Split the kernel module out of
 the base package.
Date: Sun, 06 Oct 2024 00:17:19 +0800
[Message part 1 (text/plain, inline)]
Kaelyn Takata via Guix-patches via <guix-patches <at> gnu.org> writes:

> Split the ZFS user-space tools and kernel modules into separate packages, with
> a new make-zfs-for-kernel procedure for easily creating ZFS kernel module
> packages for a specific kernel package. The generated kernel module package
> includes the kernel version for which it was built in the name of the package,
> such as "zfs-for-linux-libre-6.6.32-version".
>
> & gnu/packages/file-systems.scm (zfs): Change to be the user-space tools.
> (make-zfs-for-kernel): New procedure which accepts a single 'kernel-package'
> argument.
>
> Change-Id: Ib2d0e2b0f031d2ab3105d6b46ecd73bde1aa8564
> ---
>  gnu/packages/file-systems.scm | 126 ++++++++++++++++++++--------------
>  1 file changed, 73 insertions(+), 53 deletions(-)
>
> diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
> index 059bdf67a9..ceaaf7f3ab 100644
> --- a/gnu/packages/file-systems.scm
> +++ b/gnu/packages/file-systems.scm
> @@ -9,7 +9,7 @@
>  ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework <at> protonmail.com>
>  ;;; Copyright © 2021 Stefan Reichör <stefan <at> xsteve.at>
>  ;;; Copyright © 2021 Noisytoot <noisytoot <at> disroot.org>
> -;;; Copyright © 2021, 2023 Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
> +;;; Copyright © 2021, 2023, 2024 Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
>  ;;; Copyright © 2022 Brian Cully <bjc <at> spork.org>
>  ;;; Copyright © 2023 Aaron Covrig <aaron.covrig.us <at> ieee.org>
>  ;;; Copyright © 2024 Ahmad Draidi <a.r.draidi <at> redscript.org>
> @@ -1564,7 +1564,6 @@ (define-public zfs
>    (package
>      (name "zfs")
>      (version "2.2.6")
> -    (outputs '("out" "module" "src"))
>      (source
>        (origin
>          (method url-fetch)
> @@ -1573,33 +1572,19 @@ (define-public zfs
>                                "/zfs-" version ".tar.gz"))
>            (sha256
>             (base32 "19x2a8k25i3y6nr7nx5aaqrpnp55vjmrw86p06zpgpf578804bn9"))))
> -    (build-system linux-module-build-system)
> +    (build-system gnu-build-system)
>      (arguments
>       (list
> -      ;; The ZFS kernel module should not be downloaded since the license
> -      ;; terms don't allow for distributing it, only building it locally.
> -      #:substitutable? #f
> -      ;; Tests cannot run in an unprivileged build environment.
> -      #:tests? #f
> +      #:configure-flags #~(list "--with-config=user"
> +                                (string-append "--prefix=" #$output)
> +                                (string-append "--with-dracutdir=" #$output
> +                                               "/lib/dracut")
> +                                (string-append "--with-udevdir=" #$output
> +                                               "/lib/udev")
> +                                (string-append "--with-mounthelperdir=" #$output
> +                                               "/sbin"))
>        #:phases
>        #~(modify-phases %standard-phases
> -          (add-after 'configure 'really-configure
> -            (lambda* (#:key inputs #:allow-other-keys)
> -              (substitute* "configure"
> -                (("-/bin/sh") (string-append "-" (which "sh"))))
> -              (invoke "./configure"
> -                      "--with-config=all"
> -                      (string-append "--prefix=" #$output)
> -                      (string-append "--with-dracutdir=" #$output
> -                                     "/lib/dracut")
> -                      (string-append "--with-udevdir=" #$output
> -                                     "/lib/udev")
> -                      (string-append "--with-mounthelperdir=" #$output
> -                                     "/sbin")
> -                      (string-append "--with-linux="
> -                                     (search-input-directory
> -                                      inputs
> -                                      "lib/modules/build")))))
>            (add-after 'unpack 'patch-source
>              (lambda* (#:key inputs #:allow-other-keys)
>                ;; New feature "compatibility=" in 2.1.0.
> @@ -1631,14 +1616,6 @@ (define-public zfs
>                  ;; Just use 'modprobe' in message to user, since Guix
>                  ;; does not have a traditional /sbin/
>                  (("'/sbin/modprobe ") "'modprobe "))
> -              (substitute* "configure"
> -                (("/etc/default")
> -                 (string-append #$output "/etc/default"))
> -                (("/etc/bash_completion.d")
> -                 (string-append #$output "/etc/bash_completion.d")))
> -              (substitute* "Makefile.in"
> -                (("/usr/share/initramfs-tools")
> -                 (string-append #$output "/usr/share/initramfs-tools")))
>                (substitute* "contrib/initramfs/Makefile.am"
>                  (("/usr/share/initramfs-tools")
>                   (string-append #$output "/usr/share/initramfs-tools")))
> @@ -1668,31 +1645,22 @@ (define-public zfs
>                                  (dirname (which "sed")) ":"
>                                  (dirname (which "gawk")))))
>                (substitute* '("Makefile.am" "Makefile.in")
> -                (("\\$\\(prefix)/src") (string-append #$output:src "/src")))
> +                (("@initconfdir@") (string-append #$output "/etc/default"))
> +                (("/usr/share/initramfs-tools" dir) (string-append #$output dir)))
>                (substitute* (find-files "udev/rules.d/" ".rules.in$")
>                  (("/sbin/modprobe")
>                   (search-input-file inputs "/bin/modprobe")))))
> -          (replace 'build
> -            (lambda _ (invoke "make")))
>            (replace 'install
> -            (lambda* (#:key inputs native-inputs #:allow-other-keys)
> -              (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
> -                (invoke "make" "install"
> -                        (string-append "DEFAULT_INITCONF_DIR="
> -                                       #$output "/etc/default")
> -                        (string-append "DEPMOD="
> -                                       (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"))))))))
> +            (lambda _
> +              (invoke "make" "install"
> +                      (string-append "DEFAULT_INITCONF_DIR="
> +                                     #$output "/etc/default")
> +                      (string-append "INSTALL_PATH=" #$output)
> +                      (string-append "bashcompletiondir="
> +                                     #$output
> +                                     "/share/bash-completion/completions")))))))
>      (native-inputs
> -     (list attr kmod pkg-config))
> +     (list attr kmod pkg-config python))
>      (inputs (list eudev
>                    kmod
>                    libaio
> @@ -1712,6 +1680,58 @@ (define-public zfs
>  community.")
>      (license license:cddl1.0)))
>  
> +(define-public (make-zfs-for-kernel kernel-package)

Just to be clear, I don't know much about ZFS licensing issues.

i don't think need a procedure, just a package, If I understand the code
correctly, gnu/services.scm (linux-builder-service-type) will replace
#:linux to target-linux, and see
linux-builder-configuration->system-entry , package-for-kernel.

> +  (package
> +    (inherit zfs)
> +    (name (string-join (list (package-name zfs)
> +                             "for"
> +                             (package-name kernel-package)
> +                             (package-version kernel-package)
> +                             "version")
> +                       "-"))
> +    (build-system linux-module-build-system)
> +    (arguments
> +     (substitute-keyword-arguments
> +         (strip-keyword-arguments '(#:configure-flags)
> +                                  (package-arguments zfs))
> +       ((#:linux _ #f) kernel-package)
> +       ((#:substitutable? _ #t) #f)
> +       ((#:phases phases)
> +        #~(modify-phases %standard-phases
> +            (add-after 'unpack 'patch-source
> +              (assoc-ref #$phases 'patch-source))
> +            (add-after 'configure 'really-configure
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                (substitute* "configure"
> +                  (("-/bin/sh") (string-append "-" (which "sh"))))
> +                (invoke "./configure"
> +                        "--with-config=kernel"
> +                        (string-append "--prefix=" #$output)
> +                        (string-append "--with-udevdir=" #$output
> +                                       "/lib/udev")
> +                        (string-append "--with-linux="
> +                                       (search-input-directory
> +                                        inputs
> +                                        "lib/modules/build")))))
> +            (replace 'build
> +              (lambda* (#:key (make-flags '()) (parallel-build? #t)
> +                        #:allow-other-keys)
> +                (apply invoke "make"
> +                       `(,@(if parallel-build?
> +                               `("-j" ,(number->string (parallel-job-count)))
> +                               '())
> +                         ,@make-flags))))
> +            (replace 'install
> +              (lambda* (#:key inputs native-inputs #:allow-other-keys)
> +                (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
> +                  (invoke "make" "-C" "module" "install"
> +                          (string-append "DEPMOD="
> +                                         (search-input-file
> +                                          (or native-inputs inputs)
> +                                          "/bin/depmod"))
> +                          (string-append "INSTALL_MOD_PATH=" #$output)
> +                          "INSTALL_MOD_STRIP=1"))))))))))
> +
>  (define-public zfs-auto-snapshot
>    (package
>      (name "zfs-auto-snapshot")
>
> base-commit: b7c94d528875415ea7ec6225d88a6b3d55fa2e14
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#71482; Package guix-patches. (Sat, 05 Oct 2024 16:19:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#71482; Package guix-patches. (Sat, 05 Oct 2024 18:07:01 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kaelyn <kaelyn.alexi <at> protonmail.com>
To: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>
Cc: 71482 <at> debbugs.gnu.org,
 Kaelyn Takata via Guix-patches via <guix-patches <at> gnu.org>
Subject: Re: [bug#71482] [PATCH v2] gnu: zfs: Split the kernel module out of
 the base package.
Date: Sat, 05 Oct 2024 18:06:17 +0000
Hi,

On Saturday, October 5th, 2024 at 4:17 PM, Zheng Junjie <zhengjunjie <at> iscas.ac.cn> wrote:

> 
> 
> Kaelyn Takata via Guix-patches via guix-patches <at> gnu.org writes:
> 
> > Split the ZFS user-space tools and kernel modules into separate packages, with
> > a new make-zfs-for-kernel procedure for easily creating ZFS kernel module
> > packages for a specific kernel package. The generated kernel module package
> > includes the kernel version for which it was built in the name of the package,
> > such as "zfs-for-linux-libre-6.6.32-version".
> > 
> > & gnu/packages/file-systems.scm (zfs): Change to be the user-space tools.
> > (make-zfs-for-kernel): New procedure which accepts a single 'kernel-package'
> > argument.
> > 
> > Change-Id: Ib2d0e2b0f031d2ab3105d6b46ecd73bde1aa8564
> > ---
> > gnu/packages/file-systems.scm | 126 ++++++++++++++++++++--------------
> > 1 file changed, 73 insertions(+), 53 deletions(-)
> > 
> > diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
> > index 059bdf67a9..ceaaf7f3ab 100644
> > --- a/gnu/packages/file-systems.scm
> > +++ b/gnu/packages/file-systems.scm
> > @@ -9,7 +9,7 @@
> > ;;; Copyright © 2021 raid5atemyhomework raid5atemyhomework <at> protonmail.com
> > ;;; Copyright © 2021 Stefan Reichör stefan <at> xsteve.at
> > ;;; Copyright © 2021 Noisytoot noisytoot <at> disroot.org
> > -;;; Copyright © 2021, 2023 Kaelyn Takata kaelyn.alexi <at> protonmail.com
> > +;;; Copyright © 2021, 2023, 2024 Kaelyn Takata kaelyn.alexi <at> protonmail.com
> > ;;; Copyright © 2022 Brian Cully bjc <at> spork.org
> > ;;; Copyright © 2023 Aaron Covrig aaron.covrig.us <at> ieee.org
> > ;;; Copyright © 2024 Ahmad Draidi a.r.draidi <at> redscript.org
> > @@ -1564,7 +1564,6 @@ (define-public zfs
> > (package
> > (name "zfs")
> > (version "2.2.6")
> > - (outputs '("out" "module" "src"))
> > (source
> > (origin
> > (method url-fetch)
> > @@ -1573,33 +1572,19 @@ (define-public zfs
> > "/zfs-" version ".tar.gz"))
> > (sha256
> > (base32 "19x2a8k25i3y6nr7nx5aaqrpnp55vjmrw86p06zpgpf578804bn9"))))
> > - (build-system linux-module-build-system)
> > + (build-system gnu-build-system)
> > (arguments
> > (list
> > - ;; The ZFS kernel module should not be downloaded since the license
> > - ;; terms don't allow for distributing it, only building it locally.
> > - #:substitutable? #f
> > - ;; Tests cannot run in an unprivileged build environment.
> > - #:tests? #f
> > + #:configure-flags #~(list "--with-config=user"
> > + (string-append "--prefix=" #$output)
> > + (string-append "--with-dracutdir=" #$output
> > + "/lib/dracut")
> > + (string-append "--with-udevdir=" #$output
> > + "/lib/udev")
> > + (string-append "--with-mounthelperdir=" #$output
> > + "/sbin"))
> > #:phases
> > #~(modify-phases %standard-phases
> > - (add-after 'configure 'really-configure
> > - (lambda* (#:key inputs #:allow-other-keys)
> > - (substitute* "configure"
> > - (("-/bin/sh") (string-append "-" (which "sh"))))
> > - (invoke "./configure"
> > - "--with-config=all"
> > - (string-append "--prefix=" #$output)
> > - (string-append "--with-dracutdir=" #$output
> > - "/lib/dracut")
> > - (string-append "--with-udevdir=" #$output
> > - "/lib/udev")
> > - (string-append "--with-mounthelperdir=" #$output
> > - "/sbin")
> > - (string-append "--with-linux="
> > - (search-input-directory
> > - inputs
> > - "lib/modules/build")))))
> > (add-after 'unpack 'patch-source
> > (lambda* (#:key inputs #:allow-other-keys)
> > ;; New feature "compatibility=" in 2.1.0.
> > @@ -1631,14 +1616,6 @@ (define-public zfs
> > ;; Just use 'modprobe' in message to user, since Guix
> > ;; does not have a traditional /sbin/
> > (("'/sbin/modprobe ") "'modprobe "))
> > - (substitute* "configure"
> > - (("/etc/default")
> > - (string-append #$output "/etc/default"))
> > - (("/etc/bash_completion.d")
> > - (string-append #$output "/etc/bash_completion.d")))
> > - (substitute* "Makefile.in"
> > - (("/usr/share/initramfs-tools")
> > - (string-append #$output "/usr/share/initramfs-tools")))
> > (substitute* "contrib/initramfs/Makefile.am"
> > (("/usr/share/initramfs-tools")
> > (string-append #$output "/usr/share/initramfs-tools")))
> > @@ -1668,31 +1645,22 @@ (define-public zfs
> > (dirname (which "sed")) ":"
> > (dirname (which "gawk")))))
> > (substitute* '("Makefile.am" "Makefile.in")
> > - (("\\$\\(prefix)/src") (string-append #$output:src "/src")))
> > + (("@initconfdir@") (string-append #$output "/etc/default"))
> > + (("/usr/share/initramfs-tools" dir) (string-append #$output dir)))
> > (substitute* (find-files "udev/rules.d/" ".rules.in$")
> > (("/sbin/modprobe")
> > (search-input-file inputs "/bin/modprobe")))))
> > - (replace 'build
> > - (lambda _ (invoke "make")))
> > (replace 'install
> > - (lambda* (#:key inputs native-inputs #:allow-other-keys)
> > - (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
> > - (invoke "make" "install"
> > - (string-append "DEFAULT_INITCONF_DIR="
> > - #$output "/etc/default")
> > - (string-append "DEPMOD="
> > - (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"))))))))
> > + (lambda _
> > + (invoke "make" "install"
> > + (string-append "DEFAULT_INITCONF_DIR="
> > + #$output "/etc/default")
> > + (string-append "INSTALL_PATH=" #$output)
> > + (string-append "bashcompletiondir="
> > + #$output
> > + "/share/bash-completion/completions")))))))
> > (native-inputs
> > - (list attr kmod pkg-config))
> > + (list attr kmod pkg-config python))
> > (inputs (list eudev
> > kmod
> > libaio
> > @@ -1712,6 +1680,58 @@ (define-public zfs
> > community.")
> > (license license:cddl1.0)))
> > 
> > +(define-public (make-zfs-for-kernel kernel-package)
> 
> 
> Just to be clear, I don't know much about ZFS licensing issues.
> 
> i don't think need a procedure, just a package, If I understand the code
> correctly, gnu/services.scm (linux-builder-service-type) will replace
> #:linux to target-linux, and see
> linux-builder-configuration->system-entry , package-for-kernel.

Thanks for the pointer to some functionality I wasn't aware of! I'll have to look into it to see if it is sufficient for building the ZFS module for arbitrary kernel packages without also building the module for the default linux-libre kernel, and at the time it is needed. At least right now, I also make use of the function for providing the right ZFS kernel module for inclusion into my initramfs images, so I worry that (linux-builder-service-type)--based on its name-- ay fix up / provide the correct ZFS module too late for uses like the initramfs or a ZFS root. Though to emphasize, I'm going to look into those mechanisms to understand them better. ;)

Cheers,
Kaelyn
> 
> > + (package
> > + (inherit zfs)
> > + (name (string-join (list (package-name zfs)
> > + "for"
> > + (package-name kernel-package)
> > + (package-version kernel-package)
> > + "version")
> > + "-"))
> > + (build-system linux-module-build-system)
> > + (arguments
> > + (substitute-keyword-arguments
> > + (strip-keyword-arguments '(#:configure-flags)
> > + (package-arguments zfs))
> > + ((#:linux _ #f) kernel-package)
> > + ((#:substitutable? _ #t) #f)
> > + ((#:phases phases)
> > + #~(modify-phases %standard-phases
> > + (add-after 'unpack 'patch-source
> > + (assoc-ref #$phases 'patch-source))
> > + (add-after 'configure 'really-configure
> > + (lambda* (#:key inputs #:allow-other-keys)
> > + (substitute* "configure"
> > + (("-/bin/sh") (string-append "-" (which "sh"))))
> > + (invoke "./configure"
> > + "--with-config=kernel"
> > + (string-append "--prefix=" #$output)
> > + (string-append "--with-udevdir=" #$output
> > + "/lib/udev")
> > + (string-append "--with-linux="
> > + (search-input-directory
> > + inputs
> > + "lib/modules/build")))))
> > + (replace 'build
> > + (lambda* (#:key (make-flags '()) (parallel-build? #t)
> > + #:allow-other-keys)
> > + (apply invoke "make"
> > + `(,@(if parallel-build? +` ("-j" ,(number->string (parallel-job-count)))
> > + '())
> > + ,@make-flags))))
> > + (replace 'install
> > + (lambda* (#:key inputs native-inputs #:allow-other-keys)
> > + (let* ((kmod (assoc-ref (or native-inputs inputs) "kmod")))
> > + (invoke "make" "-C" "module" "install"
> > + (string-append "DEPMOD="
> > + (search-input-file
> > + (or native-inputs inputs)
> > + "/bin/depmod"))
> > + (string-append "INSTALL_MOD_PATH=" #$output)
> > + "INSTALL_MOD_STRIP=1"))))))))))
> > +
> > (define-public zfs-auto-snapshot
> > (package
> > (name "zfs-auto-snapshot")
> > 
> > base-commit: b7c94d528875415ea7ec6225d88a6b3d55fa2e14




Information forwarded to guix-patches <at> gnu.org:
bug#71482; Package guix-patches. (Sat, 05 Oct 2024 18:07:02 GMT) Full text and rfc822 format available.

This bug report was last modified 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.