unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 22629@debbugs.gnu.org
Subject: bug#22629: [PATCH 4/4] self: Build the Info manual.
Date: Thu, 31 May 2018 16:43:37 +0200	[thread overview]
Message-ID: <20180531144337.16298-5-ludo@gnu.org> (raw)
In-Reply-To: <20180531144337.16298-1-ludo@gnu.org>

* guix/self.scm (info-manual): New procedure.
(whole-package): Add #:info and honor it.
(compiled-guix): Pass #:info.
---
 guix/self.scm | 88 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 85 insertions(+), 3 deletions(-)

diff --git a/guix/self.scm b/guix/self.scm
index 92e69ffd5..8ed1e1073 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -230,6 +230,81 @@ DOMAIN, a gettext domain."
   (computed-file (string-append "guix-locale-" domain)
                  build))
 
+(define (info-manual source)
+  "Return the Info manual built from SOURCE."
+  (define texinfo
+    (module-ref (resolve-interface '(gnu packages texinfo))
+                'texinfo))
+
+  (define graphviz
+    (module-ref (resolve-interface '(gnu packages graphviz))
+                'graphviz))
+
+  (define build
+    ;; TODO: Don't depend on all of SOURCE to avoid rebuilds.
+    (with-imported-modules '((guix build utils))
+      #~(begin
+          (use-modules (guix build utils))
+
+          (mkdir #$output)
+
+          ;; Create 'version.texi'.
+          ;; XXX: Can we use a more meaningful version string yet one that
+          ;; doesn't change at each commit?
+          (call-with-output-file "version.texi"
+            (lambda (port)
+              (let ((version "(Git snapshot)"))
+                (format port "
+@set UPDATED 1 January 1970
+@set UPDATED-MONTH January 1970
+@set EDITION ~a
+@set VERSION ~a\n" version version))))
+
+          ;; Copy configuration templates that the manual includes.
+          (for-each (lambda (template)
+                      (copy-file template
+                                 (string-append
+                                  "os-config-"
+                                  (basename template ".tmpl")
+                                  ".texi")))
+                    (find-files #$source "\\.tmpl$"))
+
+          ;; Build graphs.
+          (mkdir-p (string-append #$output "/images"))
+          (for-each (lambda (dot-file)
+                      (invoke #+(file-append graphviz "/bin/dot")
+                              "-Tpng" "-Gratio=.9" "-Gnodesep=.005"
+                              "-Granksep=.00005" "-Nfontsize=9"
+                              "-Nheight=.1" "-Nwidth=.1"
+                              "-o" (string-append #$output "/images/"
+                                                  (basename dot-file ".dot")
+                                                  ".png")
+                              dot-file))
+                    (find-files (string-append #$source "/doc/images")
+                                "\\.dot$"))
+
+          ;; Copy other PNGs.
+          (for-each (lambda (png-file)
+                      (install-file png-file
+                                    (string-append #$output "/images")))
+                    (find-files (string-append #$source "/doc/images")
+                                "\\.png$"))
+
+          ;; Finally build the manual.  Copy it the Texinfo files to $PWD and
+          ;; add a symlink to the 'images' directory so that 'makeinfo' can
+          ;; see those images and produce image references in the Info output.
+          (copy-recursively (string-append #$source "/doc") "."
+                            #:log (%make-void-port "w"))
+          (delete-file-recursively "images")
+          (symlink (string-append #$output "/images") "images")
+          (invoke #+(file-append texinfo "/bin/makeinfo")
+                  "guix.texi"
+                  "-I" (string-append #$source "/doc")
+                  "-I" "."
+                  "-o" (string-append #$output "/guix.info")))))
+
+  (computed-file "guix-manual" build))
+
 (define* (guix-command modules #:key source (dependencies '())
                        (guile-version (effective-version)))
   "Return the 'guix' command such that it adds MODULES and DEPENDENCIES in its
@@ -275,12 +350,13 @@ load path."
 (define* (whole-package name modules dependencies
                         #:key
                         (guile-version (effective-version))
+                        info
                         (command (guix-command modules
                                                #:dependencies dependencies
                                                #:guile-version guile-version)))
   "Return the whole Guix package NAME that uses MODULES, a derivation of all
 the modules, and DEPENDENCIES, a list of packages depended on.  COMMAND is the
-'guix' program to use."
+'guix' program to use; INFO is the Info manual."
   ;; TODO: Move compiled modules to 'lib/guile' instead of 'share/guile'.
   (computed-file name
                  (with-imported-modules '((guix build utils))
@@ -292,9 +368,14 @@ the modules, and DEPENDENCIES, a list of packages depended on.  COMMAND is the
 
                        (let ((modules (string-append #$output
                                                      "/share/guile/site/"
-                                                     (effective-version))))
+                                                     (effective-version)))
+                             (info    #$info))
                          (mkdir-p (dirname modules))
-                         (symlink #$modules modules))))))
+                         (symlink #$modules modules)
+                         (when info
+                           (symlink #$info
+                                    (string-append #$output
+                                                   "/share/info"))))))))
 
 (define* (compiled-guix source #:key (version %guix-version)
                         (pull-version 1)
@@ -477,6 +558,7 @@ the modules, and DEPENDENCIES, a list of packages depended on.  COMMAND is the
                                       #:guile-version guile-version)))
            (whole-package name built-modules dependencies
                           #:command command
+                          #:info (info-manual source)
                           #:guile-version guile-version)))
         ((= 0 pull-version)
          ;; Legacy 'guix pull': just return the compiled modules.
-- 
2.17.0

  parent reply	other threads:[~2018-05-31 14:45 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 10:35 bug#22629: Towards a new 'guix pull' Ludovic Courtès
2017-02-22  7:57 ` Pjotr Prins
2017-02-24 18:21   ` Leo Famulari
2018-04-08 16:48 ` Ludovic Courtès
2018-04-08 17:45   ` Nils Gillmann
2018-05-31 14:43   ` bug#22629: [PATCH 0/4] 'guix pull' produces a self-contained Guix Ludovic Courtès
2018-05-31 14:43     ` bug#22629: [PATCH 1/4] self: Produce a complete package with the 'guix' command Ludovic Courtès
2018-05-31 14:43     ` bug#22629: [PATCH 2/4] pull: Install the new Guix in a profile Ludovic Courtès
2018-05-31 14:43     ` bug#22629: [PATCH 3/4] self: Compute and use locale data Ludovic Courtès
2018-05-31 14:43     ` Ludovic Courtès [this message]
2018-05-31 14:53     ` bug#22629: [PATCH 0/4] 'guix pull' produces a self-contained Guix Thompson, David
2018-06-01 12:13       ` Ludovic Courtès
2018-06-03 13:08         ` Pjotr Prins
2018-06-03 20:29           ` Ludovic Courtès
2018-06-04 19:12             ` Pjotr Prins
2018-05-31 18:00     ` Konrad Hinsen
2018-06-04 11:20       ` Ludovic Courtès
2018-06-05 11:45         ` Konrad Hinsen
2018-06-06 13:24           ` Ludovic Courtès
2018-06-06 15:54             ` Konrad Hinsen
2018-06-06 20:49               ` Ludovic Courtès
2018-05-31 18:58     ` Ricardo Wurmus
2018-06-01 12:11       ` Ludovic Courtès
2018-06-05 16:47     ` Fis Trivial
2018-06-06 13:27       ` Ludovic Courtès
2018-06-06 20:58         ` Fis Trivial
2018-06-09 10:07     ` Ludovic Courtès
2017-09-15 20:39       ` bug#28471: guix pull doesn't update the user manual Maxim Cournoyer
     [not found]         ` <handler.28471.D22629.152853885816765.notifdone@debbugs.gnu.org>
2018-06-13 21:46           ` bug#22629: bug#28471: closed (Re: bug#22629: [PATCH 0/4] 'guix pull' produces a self-contained Guix) Ludovic Courtès
2018-07-19  4:45     ` bug#22629: [PATCH 0/4] 'guix pull' produces a self-contained Guix Chris Marusich
2018-07-19 12:15       ` Ludovic Courtès
2018-08-28 15:16 ` bug#22629: Channels! Ludovic Courtès
2018-08-28 15:17   ` bug#22629: [PATCH 1/3] discovery: Add 'scheme-modules*' Ludovic Courtès
2018-08-28 15:17     ` bug#22629: [PATCH 2/3] Add (guix describe) and use it to initialize '%package-search-path' Ludovic Courtès
2018-08-28 15:17     ` bug#22629: [PATCH 3/3] DRAFT Add (guix channels) and use it in (guix scripts pull) Ludovic Courtès
2018-08-28 17:24   ` bug#22629: Channels! Pjotr Prins
2018-08-28 19:52   ` Mark H Weaver
2018-08-28 21:52     ` Ludovic Courtès
2018-08-29  4:09     ` Konrad Hinsen
2018-08-29 14:25       ` Ludovic Courtès
2018-08-29 15:30         ` Konrad Hinsen
2018-08-29 20:50           ` Ludovic Courtès
2018-08-29  9:29     ` Alex Sassmannshausen
2018-08-29 17:14       ` bug#22629: Channels not needed for a stable branch (was: Channels!) Mark H Weaver
2018-08-29 18:26         ` Ricardo Wurmus
2018-08-30  5:57           ` Konrad Hinsen
2018-08-30  6:42             ` bug#22629: Channels not needed for a stable branch Mark H Weaver
2018-08-30 10:10               ` Konrad Hinsen
2018-08-30 12:18                 ` bug#22629: “Stable” branch Ludovic Courtès
2018-08-30 14:10                   ` Alex Sassmannshausen
2018-08-30 22:02                     ` Ludovic Courtès
2018-08-31  9:39                       ` Konrad Hinsen
2018-08-31  9:58                         ` bug#26608: " Ludovic Courtès
2018-08-31 10:33                           ` bug#32022: " Konrad Hinsen
2018-08-31 13:01                             ` Ludovic Courtès
2018-08-31 11:24                       ` bug#26608: " Jan Nieuwenhuizen
2018-08-31 11:45                       ` bug#32022: " Ricardo Wurmus
2018-09-03 14:10                       ` Alex Sassmannshausen
2018-09-03 19:52                         ` Ludovic Courtès
2018-09-04  8:02                           ` bug#26608: " Alex Sassmannshausen
2018-09-04 12:22                             ` Ludovic Courtès
2018-09-03 20:27                         ` Ludovic Courtès
2021-08-20 11:09                       ` bug#26608: " zimoun
2018-08-30 14:46                   ` Konrad Hinsen
2018-08-29 21:02         ` bug#22629: Channels not needed for a stable branch Ludovic Courtès
2018-08-30 21:29   ` bug#22629: Channels! Ludovic Courtès
2018-08-30 21:31     ` bug#22629: [PATCH v2 1/3] discovery: Add 'scheme-modules*' Ludovic Courtès
2018-08-30 21:31       ` bug#22629: [PATCH v2 2/3] Add (guix describe) and use it to initialize '%package-search-path' Ludovic Courtès
2018-08-31 12:21         ` Ricardo Wurmus
2018-08-31 13:56           ` Ludovic Courtès
2018-08-31 14:32             ` Ricardo Wurmus
2018-08-30 21:31       ` bug#22629: [PATCH v2 3/3] Add (guix channels) and use it in (guix scripts pull) Ludovic Courtès
2018-09-02 15:11     ` bug#22629: Channels! Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180531144337.16298-5-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=22629@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).