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

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Fri, 11 Sep 2020 11:08:01 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43332 in the body.
You can then email your comments to 43332 AT debbugs.gnu.org in the normal way.

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#43332; Package guix-patches. (Fri, 11 Sep 2020 11:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 11 Sep 2020 11:08:02 GMT) Full text and rfc822 format available.

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

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: guix-patches <at> gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH] build-system: linux-module: Delete some huge items that we
 probably don't need.
Date: Fri, 11 Sep 2020 13:07:35 +0200
* 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(+)

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)




Information forwarded to guix-patches <at> gnu.org:
bug#43332; Package guix-patches. (Fri, 11 Sep 2020 11:47:01 GMT) Full text and rfc822 format available.

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

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 43332 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH v2] build-system: linux-module: Delete some huge items that we
 probably don't need.
Date: Fri, 11 Sep 2020 13:46:43 +0200
* 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 | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index 1077215671..14ff774fca 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -68,9 +68,37 @@
             (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
+                    ;"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
+                ;; Reinstate arch/**/dts since "scripts/dtc" depends on it.
+                ;; Reinstate arch/**/include directories.
+                ;; Reinstate arch/**/Makefile.
+                (for-each
+                 (lambda (name)
+                   (mkdir-p (dirname (string-append out-lib-build "/" name)))
+                   (copy-recursively name
+                                     (string-append out-lib-build "/" name)))
+                 (append (find-files "arch" "^(dts|include)$" #:directories? #t)
+                         (find-files "arch" "Makefile")))
                 (let* ((linux (assoc-ref inputs "linux")))
                   (install-file (string-append linux "/System.map")
                                 out-lib-build)




Information forwarded to guix-patches <at> gnu.org:
bug#43332; Package guix-patches. (Fri, 11 Sep 2020 11:53:01 GMT) Full text and rfc822 format available.

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

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 43332 <at> debbugs.gnu.org
Subject: Re: [PATCH v2] build-system: linux-module: Delete some huge items
 that we probably don't need.
Date: Fri, 11 Sep 2020 13:51:57 +0200
[Message part 1 (text/plain, inline)]
v2 reduces the size of linux-module-builder to 176 MiB (from 255 MiB in v1).
However, it needs to do some invasive stuff that is a little more difficult to
maintain than v1.

With v2, the biggest remaining toplevel directories in linux-module-builder are
the following (including sizes in MB as first column):

6       ./lib/modules/build/arch/powerpc
6       ./lib/modules/build/include/uapi/linux
6       ./lib/modules/build/lib
6       ./lib/modules/build/scripts
7       ./lib/modules/build/arch/mips
8       ./lib/modules/build/arch/arm64/boot
8       ./lib/modules/build/arch/arm64/boot/dts
8       ./lib/modules/build/include/uapi
9       ./lib/modules/build/arch/arm64
11      ./lib/modules/build/kernel
13      ./lib/modules/build/tools
14      ./lib/modules/build/include/config
19      ./lib/modules/build/arch/arm/boot
19      ./lib/modules/build/arch/arm/boot/dts
22      ./lib/modules/build/include/linux
23      ./lib/modules/build/arch/arm
59      ./lib/modules/build/include
62      ./lib/modules/build/arch

The total is 176 MiB.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#43332; Package guix-patches. (Sun, 13 Sep 2020 21:26:03 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 43332 <at> debbugs.gnu.org
Subject: Re: [bug#43332] [PATCH] build-system: linux-module: Delete some
 huge items that we probably don't need.
Date: Sun, 13 Sep 2020 23:25:35 +0200
Hi Danny,

Danny Milosavljevic <dannym <at> 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’.




Reply sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
You have taken responsibility. (Mon, 14 Sep 2020 08:32:01 GMT) Full text and rfc822 format available.

Notification sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
bug acknowledged by developer. (Mon, 14 Sep 2020 08:32:02 GMT) Full text and rfc822 format available.

Message #19 received at 43332-done <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 43332-done <at> debbugs.gnu.org
Subject: Re: [bug#43332] [PATCH] build-system: linux-module: Delete some
 huge items that we probably don't need.
Date: Mon, 14 Sep 2020 10:30:51 +0200
[Message part 1 (text/plain, inline)]
Pushed v2 to guix master as commit 2be5c2652a5fd79089048905ff6be60d74244d7b.
[Message part 2 (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 12 Oct 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 196 days ago.

Previous Next


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