all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#29515] [PATCH 0/2] Reducing the closure of man-db
@ 2017-12-01  9:56 Ludovic Courtès
  2017-12-01  9:58 ` [bug#29515] [PATCH 1/2] gnu: Add groff-minimal Ludovic Courtès
  2017-12-01 18:23 ` [bug#29515] [PATCH 0/2] Reducing the closure of man-db Leo Famulari
  0 siblings, 2 replies; 5+ messages in thread
From: Ludovic Courtès @ 2017-12-01  9:56 UTC (permalink / raw)
  To: 29515

Hello,

These patches reduce the man-db closure significantly, notably by
removing Perl and Gawk from the reference graph.  Incidentally, that
also removes Perl from the reference graph of the GuixSD installation
image.

I’ve confirmed that the resulting man-db still works as expected by
running commands like:

  ./pre-inst-env guix environment -C --ad-hoc man-db man-pages \
     -- man pthread_create

Feedback welcome!

Ludo’.

Ludovic Courtès (2):
  gnu: Add groff-minimal.
  gnu: man-db: Use 'groff-minimal' at run time.

 gnu/packages/groff.scm | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 gnu/packages/man.scm   | 18 +++++++++++++-----
 2 files changed, 60 insertions(+), 5 deletions(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#29515] [PATCH 1/2] gnu: Add groff-minimal.
  2017-12-01  9:56 [bug#29515] [PATCH 0/2] Reducing the closure of man-db Ludovic Courtès
@ 2017-12-01  9:58 ` Ludovic Courtès
  2017-12-01  9:58   ` [bug#29515] [PATCH 2/2] gnu: man-db: Use 'groff-minimal' at run time Ludovic Courtès
  2017-12-01 18:23 ` [bug#29515] [PATCH 0/2] Reducing the closure of man-db Leo Famulari
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2017-12-01  9:58 UTC (permalink / raw)
  To: 29515

* gnu/packages/groff.scm (groff-minimal): New variable.
---
 gnu/packages/groff.scm | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/gnu/packages/groff.scm b/gnu/packages/groff.scm
index 67dd1dbfa..9b949f8ff 100644
--- a/gnu/packages/groff.scm
+++ b/gnu/packages/groff.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,52 @@ is usually the formatter of \"man\" documentation pages.")
    (license gpl3+)
    (home-page "https://www.gnu.org/software/groff/")))
 
+(define-public groff-minimal
+  ;; Minimialist groff for use by man-db.  Its closure size is less than half
+  ;; that of the full-blown groff.
+  (package
+    (inherit groff)
+    (name "groff-minimal")
+    (synopsis "Minimalist variant of Groff for use by man-db")
+    (outputs '("out"))
+
+    ;; Omit the DVI, PS, PDF, and HTML backends.
+    (inputs '())
+    (native-inputs `(("bison" ,bison)
+                     ("perl" ,perl)))
+
+    (arguments
+     `(#:disallowed-references (,perl)
+
+       #:configure-flags '("--docdir=/tmp/trash/doc")
+
+       #:phases (modify-phases %standard-phases
+                  (add-after 'install 'remove-non-essential-programs
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      ;; Keep only the programs that man-db needs at run time,
+                      ;; and make sure we don't pull in Perl.
+                      (let ((out  (assoc-ref outputs "out"))
+                            (kept '("eqn" "neqn" "pic" "tbl" "refer"
+                                    "nroff" "groff" "troff" "grotty")))
+                        (for-each (lambda (file)
+                                    (unless (member (basename file) kept)
+                                      (delete-file file)))
+                                  (find-files (string-append out "/bin")))
+
+                        ;; Remove a bunch of unneeded Perl scripts.
+                        (for-each delete-file (find-files out "\\.pl$"))
+                        (for-each delete-file
+                                  (find-files out "BuildFoundries"))
+
+                        ;; Remove ~3 MiB from share/groff/X.Y/font/devBACKEND
+                        ;; corresponding to the unused backends.
+                        (for-each delete-file-recursively
+                                  (find-files out "^dev(dvi|ps|pdf|html|lj4)$"
+                                              #:directories? #t))
+                        #t))))
+
+       ,@(package-arguments groff)))))
+
 ;; There are no releases, so we take the latest commit.
 (define-public roffit
   (let ((commit "e5228388e3faf2b7f1ae5bd048ad46ed565304c6")
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#29515] [PATCH 2/2] gnu: man-db: Use 'groff-minimal' at run time.
  2017-12-01  9:58 ` [bug#29515] [PATCH 1/2] gnu: Add groff-minimal Ludovic Courtès
@ 2017-12-01  9:58   ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2017-12-01  9:58 UTC (permalink / raw)
  To: 29515

This reduces the closure of man-db from 175 MiB to 97 MiB.

* gnu/packages/man.scm (man-db)[native-inputs]: Add GROFF.
[inputs]: Replace GROFF with GROFF-MINIMAL.
[arguments]: #:configure-flags now refers to GROFF-MINIMAL.
Add #:disallowed-references.
---
 gnu/packages/man.scm | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/man.scm b/gnu/packages/man.scm
index fed7d08ae..4e21b0df6 100644
--- a/gnu/packages/man.scm
+++ b/gnu/packages/man.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2014, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
@@ -67,7 +67,7 @@ a flexible and convenient way.")
                 "0gqgs4zc3r87apns0k5qp689p2ylxx2596s2mkmkxjjay99brv88"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-after 'patch-source-shebangs 'patch-test-shebangs
            (lambda* (#:key outputs #:allow-other-keys)
@@ -87,6 +87,7 @@ a flexible and convenient way.")
              #t)))
        #:configure-flags
        (let ((groff (assoc-ref %build-inputs "groff"))
+             (groff-minimal (assoc-ref %build-inputs "groff-minimal"))
              (less  (assoc-ref %build-inputs "less"))
              (gzip  (assoc-ref %build-inputs "gzip"))
              (bzip2 (assoc-ref %build-inputs "bzip2"))
@@ -109,17 +110,24 @@ a flexible and convenient way.")
                        (string-append "--with-systemdtmpfilesdir="
                                       %output "/lib/tmpfiles.d"))
                  (map (lambda (prog)
-                        (string-append "--with-" prog "=" groff "/bin/" prog))
+                        (string-append "--with-" prog "=" groff-minimal
+                                       "/bin/" prog))
                       '("nroff" "eqn" "neqn" "tbl" "refer" "pic"))))
+
+       ;; At run time we should refer to GROFF-MINIMAL, not GROFF (the latter
+       ;; pulls in Perl.)
+       #:disallowed-references (,groff)
+
        #:modules ((guix build gnu-build-system)
                   (guix build utils)
                   (srfi srfi-1))))
     (native-inputs
-     `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ("groff" ,groff)))   ;needed at build time (troff, grops, soelim, etc.)
     (inputs
      `(("flex" ,flex)
        ("gdbm" ,gdbm)
-       ("groff" ,groff)
+       ("groff-minimal" ,groff-minimal)
        ("less" ,less)
        ("libpipeline" ,libpipeline)
        ("util-linux" ,util-linux)))
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#29515] [PATCH 0/2] Reducing the closure of man-db
  2017-12-01  9:56 [bug#29515] [PATCH 0/2] Reducing the closure of man-db Ludovic Courtès
  2017-12-01  9:58 ` [bug#29515] [PATCH 1/2] gnu: Add groff-minimal Ludovic Courtès
@ 2017-12-01 18:23 ` Leo Famulari
  2017-12-02 14:10   ` bug#29515: " Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: Leo Famulari @ 2017-12-01 18:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 29515

[-- Attachment #1: Type: text/plain, Size: 558 bytes --]

On Fri, Dec 01, 2017 at 10:56:49AM +0100, Ludovic Courtès wrote:
> Hello,
> 
> These patches reduce the man-db closure significantly, notably by
> removing Perl and Gawk from the reference graph.  Incidentally, that
> also removes Perl from the reference graph of the GuixSD installation
> image.
> 
> I’ve confirmed that the resulting man-db still works as expected by
> running commands like:
> 
>   ./pre-inst-env guix environment -C --ad-hoc man-db man-pages \
>      -- man pthread_create
> 
> Feedback welcome!

I think it's great!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29515: [PATCH 0/2] Reducing the closure of man-db
  2017-12-01 18:23 ` [bug#29515] [PATCH 0/2] Reducing the closure of man-db Leo Famulari
@ 2017-12-02 14:10   ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2017-12-02 14:10 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 29515-done

Leo Famulari <leo@famulari.name> skribis:

> On Fri, Dec 01, 2017 at 10:56:49AM +0100, Ludovic Courtès wrote:
>> Hello,
>> 
>> These patches reduce the man-db closure significantly, notably by
>> removing Perl and Gawk from the reference graph.  Incidentally, that
>> also removes Perl from the reference graph of the GuixSD installation
>> image.
>> 
>> I’ve confirmed that the resulting man-db still works as expected by
>> running commands like:
>> 
>>   ./pre-inst-env guix environment -C --ad-hoc man-db man-pages \
>>      -- man pthread_create
>> 
>> Feedback welcome!
>
> I think it's great!

Thanks, pushed!  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-02 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01  9:56 [bug#29515] [PATCH 0/2] Reducing the closure of man-db Ludovic Courtès
2017-12-01  9:58 ` [bug#29515] [PATCH 1/2] gnu: Add groff-minimal Ludovic Courtès
2017-12-01  9:58   ` [bug#29515] [PATCH 2/2] gnu: man-db: Use 'groff-minimal' at run time Ludovic Courtès
2017-12-01 18:23 ` [bug#29515] [PATCH 0/2] Reducing the closure of man-db Leo Famulari
2017-12-02 14:10   ` bug#29515: " Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.