diff mbox series

[bug#43332] build-system: linux-module: Delete some huge items that we probably don't need.

Message ID 20200911110735.8208-1-dannym@scratchpost.org
State Accepted
Headers show
Series [bug#43332] build-system: linux-module: Delete some huge items that we probably don't need. | expand

Commit Message

Danny Milosavljevic Sept. 11, 2020, 11:07 a.m. UTC
* guix/build-system/linux-module.scm (make-linux-module-builder): Delete
some huge items that we probably don't need.
---
 guix/build-system/linux-module.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Ludovic Courtès Sept. 13, 2020, 9:25 p.m. UTC | #1
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * guix/build-system/linux-module.scm (make-linux-module-builder): Delete
> some huge items that we probably don't need.

Yay!  I’m fine with either v1 or v2, with one nit:

> +                (for-each
> +                 (lambda (name)
> +                   (if (file-exists? name)
> +                       (delete-file-recursively name)))
> +                 (map
> +                  (lambda (name)
> +                    (string-append out-lib-build "/" name))
> +                  '(;"arch" ; 137 MB ; Note: "scripts/dtc" depends on "arch".
> +                    ;"tools" ; 44 MB ; Note: is built by our 'build phase.
> +                    "tools/testing" ; 14 MB
> +                    "tools/perf" ; 17 MB
> +                    "drivers" ; 600 MB
> +                    "Documentation" ; 52 MB
> +                    "fs" ; 43 MB
> +                    "net" ; 33 MB
> +                    "samples" ; 2 MB
> +                    "sound"))) ; 40 MB

Usually the first argument to ‘map’ and ‘for-each’ is on the same line:

  (for-each (lambda …)

If you’re afraid of hitting the 80 char limit or something, then I
suggest defining a local procedure.

Also, use ‘when’ instead of a one-arm ‘if’, for clarity.

Thanks!

Ludo’.
Danny Milosavljevic Sept. 14, 2020, 8:30 a.m. UTC | #2
Pushed v2 to guix master as commit 2be5c2652a5fd79089048905ff6be60d74244d7b.
diff mbox series

Patch

diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index 1077215671..ba47817596 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -68,9 +68,27 @@ 
             (lambda* (#:key inputs outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
                      (out-lib-build (string-append out "/lib/modules/build")))
+                ;; Delete some huge items that we probably don't need.
                 ;; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig,
                 ;; scripts, include, ".config".
                 (copy-recursively "." out-lib-build)
+                (for-each
+                 (lambda (name)
+                   (if (file-exists? name)
+                       (delete-file-recursively name)))
+                 (map
+                  (lambda (name)
+                    (string-append out-lib-build "/" name))
+                  '(;"arch" ; 137 MB ; Note: "scripts/dtc" depends on "arch".
+                    ;"tools" ; 44 MB ; Note: is built by our 'build phase.
+                    "tools/testing" ; 14 MB
+                    "tools/perf" ; 17 MB
+                    "drivers" ; 600 MB
+                    "Documentation" ; 52 MB
+                    "fs" ; 43 MB
+                    "net" ; 33 MB
+                    "samples" ; 2 MB
+                    "sound"))) ; 40 MB
                 (let* ((linux (assoc-ref inputs "linux")))
                   (install-file (string-append linux "/System.map")
                                 out-lib-build)