Subject: bug#59811: closed (Re: bug#59811: [PATCH] gnu: linux-libre: Move documentation to a separate package.)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 07 Dec 2022 03:24:01 +0000

Your bug report

#59811: [PATCH] gnu: linux-libre: Move documentation to a separate package.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59811: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59811
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59811: [PATCH] gnu: linux-libre: Move documentation to a separate package.
From: Maxim Cournoyer <[email-masked]>
To: [email-masked]
Date: Tue, 06 Dec 2022 22:22:54 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Maxim Cournoyer <[email-masked]> writes:

> * gnu/packages/linux.scm (linux-libre-5.15-source)
> (linux-libre-5.10-source): Do not apply linux-libre-infodocs-target.patch.
> (make-linux-libre): Remove BUILD-DOC? argument, and
> adjust patches conditional.
> (make-linux-libre*): Likewise.  Remove build-doc? validation.
> [arguments]: Move documentation related phases to the new
> linux-libre-documentation.
> [native-inputs]: Move the documentation related native inputs to
> linux-libre-documentation.
> (linux-libre-documentation): New variable.
> * guix/build-system/linux-module.scm
> (make-linux-module-builder) [arguments]: Do not delete build-doc and
> install-doc phases, which no longer exist for linux-libre.

I've tested this for a couple days and it seems fine, so I've applied it
to master already.  You can now 'info linux' to read its doc.

Closing.

-- 
Thanks,
Maxim

Subject: [PATCH] gnu: linux-libre: Move documentation to a separate package.
From: Maxim Cournoyer <[email-masked]>
To: [email-masked]
Cc: Maxim Cournoyer <[email-masked]>
Date: Sat, 3 Dec 2022 21:38:04 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/linux.scm (linux-libre-5.15-source)
(linux-libre-5.10-source): Do not apply linux-libre-infodocs-target.patch.
(make-linux-libre): Remove BUILD-DOC? argument, and
adjust patches conditional.
(make-linux-libre*): Likewise.  Remove build-doc? validation.
[arguments]: Move documentation related phases to the new
linux-libre-documentation.
[native-inputs]: Move the documentation related native inputs to
linux-libre-documentation.
(linux-libre-documentation): New variable.
* guix/build-system/linux-module.scm
(make-linux-module-builder) [arguments]: Do not delete build-doc and
install-doc phases, which no longer exist for linux-libre.
---
 gnu/packages/linux.scm             | 82 ++++++++++++++++--------------
 guix/build-system/linux-module.scm |  2 -
 2 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 8c417fb600..f22f6ed8cf 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -523,14 +523,12 @@ (define-public linux-libre-6.0-source
 (define-public linux-libre-5.15-source
   (source-with-patches linux-libre-5.15-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch
-                             (search-patch "linux-libre-infodocs-target.patch"))))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
 
 (define-public linux-libre-5.10-source
   (source-with-patches linux-libre-5.10-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch
-                             (search-patch "linux-libre-infodocs-target.patch"))))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
 
 (define-public linux-libre-5.4-source
   (source-with-patches linux-libre-5.4-pristine-source
@@ -798,10 +796,9 @@ (define* (make-linux-libre version gnu-revision hash-string supported-systems
                            (configuration-file #f)
                            (defconfig "defconfig")
                            (extra-options %default-extra-linux-options)
-                           (build-doc? (doc-supported? version))
                            (patches
                             `(,%boot-logo-patch
-                              ,@(if build-doc?
+                              ,@(if (doc-supported? version)
                                     (list (search-patch
                                            "linux-libre-infodocs-target.patch"))
                                     '()))))
@@ -815,8 +812,7 @@ (define* (make-linux-libre version gnu-revision hash-string supported-systems
                      #:extra-version extra-version
                      #:configuration-file configuration-file
                      #:defconfig defconfig
-                     #:extra-options extra-options
-                     #:build-doc? build-doc?))
+                     #:extra-options extra-options))
 
 (define* (make-linux-libre* version gnu-revision source supported-systems
                             #:key
@@ -825,10 +821,7 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
                             ;; See kernel-config for an example.
                             (configuration-file #f)
                             (defconfig "defconfig")
-                            (extra-options %default-extra-linux-options)
-                            (build-doc? (doc-supported? version)))
-  (when (and build-doc? (not (doc-supported? version)))
-    (error "unsupported 'build-doc?' for kernels <5.10"))
+                            (extra-options %default-extra-linux-options))
   (package
     (name (if extra-version
               (string-append "linux-libre-" extra-version)
@@ -853,20 +846,6 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
               (substitute* (find-files
                             "." "^Makefile(\\.include)?$")
                 (("/bin/pwd") "pwd"))))
-          #$@(if build-doc?
-                 #~((add-before 'configure 'build-doc
-                      (lambda _
-                        (substitute* "Documentation/Makefile"
-                          ;; Remove problematic environment check script.
-                          ((".*scripts/sphinx-pre-install.*") ""))
-                        (invoke "make" "infodocs")))
-                    (add-after 'build-doc 'install-doc
-                      (lambda _
-                        (with-directory-excursion "Documentation/output"
-                          (invoke "make" "-C" "texinfo" "install-info"
-                                  (string-append "infodir=" #$output
-                                                 "/share/info"))))))
-                 #~())
           (add-before 'configure 'set-environment
             (lambda* (#:key target #:allow-other-keys)
               ;; Avoid introducing timestamps.
@@ -966,19 +945,6 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
        ("gmp" ,gmp)
        ("mpfr" ,mpfr)
        ("mpc" ,mpc)
-
-       ;; For generating the documentation.
-       ,@(if build-doc?
-             ;; TODO: remove fontconfig after the 5.10 kernel is dropped.
-             ;; Also replace python-wrapper by python at that time.
-             `(("fontconfig" ,fontconfig)
-               ("graphviz" ,graphviz)
-               ("python" ,python-wrapper)
-               ("python-sphinx" ,python-sphinx)
-               ("texinfo" ,texinfo)
-               ("which" ,which))
-             '())
-
        ,@(match (let ((arch (platform-linux-architecture
                              (lookup-platform-by-target-or-system
                               (or (%current-target-system)
@@ -1017,6 +983,44 @@ (define-public linux-libre-pristine-source linux-libre-6.0-pristine-source)
 (define-public linux-libre-source          linux-libre-6.0-source)
 (define-public linux-libre                 linux-libre-6.0)
 
+(define-public linux-libre-documentation
+  (package
+    (inherit linux-libre)
+    (name "linux-libre-documentation")
+    (arguments
+     (list
+      #:tests? #f
+      #:phases #~(modify-phases %standard-phases
+                   (delete 'configure)
+                   (replace 'build
+                     (lambda _
+                       (substitute* "Documentation/Makefile"
+                         ;; Remove problematic environment check script.
+                         ((".*scripts/sphinx-pre-install.*") ""))
+                       (invoke "make" "infodocs")))
+                   (replace 'install
+                     (lambda _
+                       (let* ((info-dir (string-append #$output "/share/info"))
+                              (info (string-append info-dir
+                                                   "/TheLinuxKernel.info.gz")))
+                         (with-directory-excursion "Documentation/output"
+                           (invoke "make" "-C" "texinfo" "install-info"
+                                   (string-append "infodir=" info-dir)))
+                         ;; Create a symlink, for convenience.
+                         (symlink info (string-append info-dir
+                                                      "/linux.info.gz"))))))))
+    (native-inputs
+     (list fontconfig
+           graphviz
+           perl
+           python
+           python-sphinx
+           texinfo
+           which))
+    (synopsis "Documentation for the kernel Linux-Libre")
+    (description "This package provides the documentation for the kernel
+Linux-Libre, as an Info manual.  To consult it, run @samp{info linux}.")))
+
 (define-public linux-libre-5.15
   (make-linux-libre* linux-libre-5.15-version
                      linux-libre-5.15-gnu-revision
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index c1ddeaea10..e46195b53c 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -67,8 +67,6 @@ (define (make-linux-module-builder linux)
               (lambda _
                 (invoke "make" "modules_prepare")))
             (delete 'strip)             ;faster
-            (delete 'build-doc)         ;costly and not useful here
-            (delete 'install-doc)
             (replace 'install
               (lambda* (#:key inputs #:allow-other-keys)
                 (let ((out-lib-build (string-append #$output "/lib/modules/build")))

base-commit: bf46192d4c7c4cd8d71edb8ace2cdf86322aafe7
-- 
2.38.1