GNU bug report logs - #63081
[PATCH 0/8] Comprehensive DocBook refactoring.

Previous Next

Package: guix-patches;

Reported by: Bruno Victal <mirai <at> makinata.eu>

Date: Wed, 26 Apr 2023 00:54:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

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 63081 in the body.
You can then email your comments to 63081 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 maxim.cournoyer <at> gmail.com, andreas <at> enge.fr, guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bruno Victal <mirai <at> makinata.eu>:
New bug report received and forwarded. Copy sent to maxim.cournoyer <at> gmail.com, andreas <at> enge.fr, guix-patches <at> gnu.org. (Wed, 26 Apr 2023 00:54:02 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: guix-patches <at> gnu.org
Cc: Bruno Victal <mirai <at> makinata.eu>
Subject: [PATCH 0/8] Comprehensive DocBook refactoring.
Date: Wed, 26 Apr 2023 01:52:53 +0100
Notable changes:
* Fixes profile conflicts for docbook-xml packages by using versioned paths.
* Implements the path convention used by NixOS for docbook-xml 4.x packages,
this allows for packages that use cmake to search for these files (such as kdoctools)
to work correctly without having to patch the sources.
* Stores the schema files correctly rather than lumping it all within …/dtd/.
* Source fetching methods were reviewed and were fixed where incorrect. (docbook-xml-5.1)
* Unbundles binary leftovers in docbook-xsl-1.79.1 packages.
* Removes executable permissions for SGML DTDs.
* Uses proper tools to manipulate XML instead of substitute*.
* Uses sxml instead of representing XML as a string.
* Fixes tests for docbook-xsl.
* Uses copy-build-system over trivial-build-system.
* Modernizes the style used for the package definitions.


It is hoped that these patches will substantially reduce the amount of
source patching done in guix and solve obscure build failures.

This patch-series is “Core-Updates” material, it will trigger mass rebuilds.


Bruno Victal (8):
  gnu: docbook-xml: Fix installation paths.
  gnu: Add docbook-xml-5.0.1.
  gnu: docbook-xsl: Refactor package.
  gnu: docbook-xsl-1.79.1: Refactor package.
  gnu: docbook-utils: Refactor package.
  gnu: docbook: Refactor docbook-sgml packages.
  gnu: docbook: Refactor dblatex packages.
  gnu: docbook-dsssl: Switch to copy-build-system.

 gnu/packages/docbook.scm | 875 +++++++++++++++++++++++----------------
 1 file changed, 507 insertions(+), 368 deletions(-)


base-commit: 8093c6ba21c51efe901ba98ce698c545bf13dcd0
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:58:02 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 2/8] gnu: Add docbook-xml-5.0.1.
Date: Wed, 26 Apr 2023 01:56:54 +0100
* gnu/packages/docbook.xml (docbook-xml-5.0.1): New variable.
---
 gnu/packages/docbook.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 73a14855b9..79d5069fb0 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -120,6 +120,30 @@ (define-public docbook-xml-5.1
            ;; substitution has no effect.
            ((#:install-plan _ #f)
             #~`(("schemas/" #$dest-dir)))))))))
+
+(define-public docbook-xml-5.0.1
+  (let* ((version "5.0.1")
+         (source (origin
+                   (method url-fetch)
+                   (uri (string-append "https://docbook.org/xml/" version
+                                       "/docbook-" version ".zip"))
+                   (sha256
+                    (base32
+                     "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
+         (template (docbook-xml-package source version)))
+    (package
+      (inherit template)
+      (arguments
+       (let ((dest-dir (format #f "xml/docbook/~a/" version)))
+         (substitute-keyword-arguments (package-arguments template)
+           ((#:install-plan _ #f)
+            #~`(("catalog.xml" #$dest-dir)
+                ("docbook.nvdl" #$dest-dir)
+                ("dtd" #$dest-dir)
+                ("rng" #$dest-dir)
+                ("sch" #$dest-dir)
+                ("xsd" #$dest-dir)))))))))
+
 ;; XXX: docbook-xml-4.x versions use the same #:install-plan but since the
 ;; paths are versioned we can't use (inherit …).
 (define* (docbook-xml-4.x-package source version)
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:58:02 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 3/8] gnu: docbook-xsl: Refactor package.
Date: Wed, 26 Apr 2023 01:56:55 +0100
* gnu/packages/docbook.scm (docbook-xsl)[source]: Patch in snippet.
[arguments]: Use sxml representation for xmlc file.
Use xmlcatalog to manipulate catalog.xml instead of substitute*.
Use #:install-plan instead of replacing 'install phase.
[native-inputs]: Add docbook-xml-4.4 and libxml2, required for tests.
---
 gnu/packages/docbook.scm | 158 +++++++++++++++++++++++++--------------
 1 file changed, 102 insertions(+), 56 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 79d5069fb0..2fe0c2dbc5 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -290,9 +290,16 @@ (define-public docbook-xsl
                       (url "https://github.com/docbook/xslt10-stylesheets")
                       (commit commit)))
                 (file-name (git-file-name name version))
-                ;; Multiple .jar files are bundled with the sources.
                 (modules '((guix build utils)))
-                (snippet '(for-each delete-file (find-files "." "\\.jar$")))
+                (snippet
+                 #~(begin
+                     ;; Multiple .jar files are bundled with the sources.
+                     (for-each delete-file
+                               (find-files "." "\\.jar$"))
+                     ;; Do not build webhelp files, as they require a Saxon from
+                     ;; 2005, which is not packaged in Guix.
+                     (substitute* "xsl/Makefile"
+                       ((" webhelp") ""))))
                 (sha256
                  (base32
                   "1bl8dwrcy7skrlh80fpsmiw045bv2j0aym231ikcv3hvm2pi98dj"))))
@@ -300,67 +307,106 @@ (define-public docbook-xsl
       (arguments
        (list
         #:make-flags #~(list "XSLTENGINE=xsltproc")
+        #:modules '((guix build gnu-build-system)
+                    (guix build utils)
+                    (sxml simple))
         #:phases
-        #~(modify-phases %standard-phases
-            (replace 'configure
-              (lambda _
-                ;; The build systems insist on a ~/.xmlc, and it is simpler to
-                ;; create a dummy config file than to patch it into
-                ;; submission.
-                (setenv "HOME" "/tmp")
-                (call-with-output-file "/tmp/.xmlc"
-                  (lambda (port)
-                    (format port "\
-<?xml version='1.0' encoding='utf-8'?> <!-- -*- nxml -*- -->
-<config>
-  <java xml:id=\"bigmem\">
-    <java-option name=\"Xmx512m\"/>
-  </java>
-  <xsltproc xml:id=\"xsltproc\" exec=\"xsltproc\"></xsltproc>
-  <xmllint xml:id=\"xmllint\" exec=\"xmllint\"></xmllint>
-</config>\n")))
-                (substitute* "xsl/Makefile"
-                  ;; Do not build webhelp files, as they require a Saxon from
-                  ;; 2005, which is not packaged in Guix.
-                  ((" webhelp") ""))))
-            (add-before 'install 'generate-catalog.xml
-              (lambda* (#:key make-flags #:allow-other-keys)
-                (apply invoke "make" "-C" "xsl" "catalog.xml" make-flags)))
+        #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a"
+                                   #$output #$name #$version)))
+            (modify-phases %standard-phases
+              (replace 'configure
+                (lambda _
+                  ;; The build systems insist on a ~/.xmlc, and it is simpler to
+                  ;; create a dummy config file than to patch it into
+                  ;; submission.
+                  (setenv "HOME" "/tmp")
+                  (call-with-output-file "/tmp/.xmlc"
+                    (lambda (port)
+                      (sxml->xml
+                       '(*TOP*
+                         (*PI* xml "version='1.0'")
+                         (config
+                          (java (@ (xml:id "bigmem"))
+                                (java-options (@ (name "Xmx512m"))))
+                          (xsltproc (@ (xml:id "xsltproc")
+                                       (exec "xsltproc")))
+                          (xmllint (@ (xml:id "xmllint")
+                                      (exec "xmllint")))))
+                       port)))))
+              (add-before 'install 'generate-catalog.xml
+                (lambda* (#:key make-flags #:allow-other-keys)
+                  (apply invoke "make" "-C" "xsl" "catalog.xml" make-flags)))
+              (add-before 'install 'patch-catalog-xml
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (let ((xmlcatalog (search-input-file inputs
+                                                       "/bin/xmlcatalog"))
+                        (catalog-files (find-files "." "catalog\\.xml$"))
+                        (store-uri (string-append "file://" dest-path "/")))
+                    (for-each
+                     (lambda (catalog)
+                       ;; Replace /snapshot/ reference with one based on
+                       ;; BASE-VERSION.
+                       (let ((versioned-uri
+                              (format
+                               #f "https://cdn.docbook.org/release/xsl/~a/"
+                               #$base-version)))
+                         (invoke xmlcatalog "--noout"
+                                 "--del"
+                                 "https://cdn.docbook.org/release/xsl/snapshot/"
+                                 catalog)
+                         (for-each
+                          (lambda (type)
+                            (invoke xmlcatalog "--noout"
+                                    "--add" type
+                                    versioned-uri
+                                    store-uri
+                                    catalog))
+                          (list "rewriteSystem" "rewriteURI")))
+
+                       ;; Patch /current/ references to point to /gnu/store/….
+                       (for-each
+                        (lambda (type)
+                          (invoke xmlcatalog "--noout"
+                                  "--add" type
+                                  "https://cdn.docbook.org/release/xsl/current/"
+                                  store-uri
+                                  catalog))
+                        (list "rewriteSystem" "rewriteURI"))
+
+                       ;; Re-add the no longer present compatibility entries for
+                       ;; v.1.79.1 or earlier URIs.
+                       (for-each
+                        (lambda (type)
+                          (invoke xmlcatalog "--noout"
+                                  "--add" type
+                                  "http://docbook.sourceforge.net/release/xsl/current/"
+                                  store-uri
+                                  catalog))
+                        (list "rewriteSystem" "rewriteURI")))
+                     catalog-files))))
             (replace 'install
               (lambda _
-                (let ((xml (string-append #$output "/xml/xsl/"
-                                          #$name "-" #$version))
-                      (select-rx (make-regexp
+                (let ((select-rx (make-regexp
                                   "(\\.xml$|\\.xsl$|\\.dtd$|\\.ent$)")))
                   ;; Install catalog.
                   (chdir "xsl")
-                  (install-file "catalog.xml" xml)
-                  (install-file "VERSION.xsl" xml)
-                  (substitute* (string-append xml "/catalog.xml")
-                    ;; Re-add the no longer present compatibility entries.
-                    ((".*</catalog>.*" anchor)
-                     (string-append "\
-  <!-- Also support old URI of v1.79.1 or earlier -->
-  <rewriteURI uriStartString=\"http://docbook.sourceforge.net\
-/release/xsl/current/\" rewritePrefix=\"./\"/>
-  <rewriteSystem systemIdStartString=\"http://docbook.sourceforge.net\
-/release/xsl/current/\" rewritePrefix=\"./\"/>\n" anchor))
-                    (("/snapshot/")
-                     (string-append "/" #$base-version "/"))
-                    (("rewritePrefix=\"./")
-                     (string-append "rewritePrefix=\"file://" xml "/")))
+                  (install-file "catalog.xml" dest-path)
+                  (install-file "VERSION.xsl" dest-path)
                   ;; Install style sheets.
-                  (for-each (lambda (dir)
-                              (for-each (lambda (f)
-                                          (install-file
-                                           f (string-append xml "/" (dirname f))))
-                                        (find-files dir select-rx)))
-                            '("assembly" "common" "eclipse" "epub" "epub3" "fo"
-                              "highlighting" "html" "htmlhelp" "javahelp" "lib"
-                              "manpages" "params" "profiling" "roundtrip"
-                              "template" "website"
-                              "xhtml" "xhtml-1_1" "xhtml5"))))))))
-      (native-inputs (list libxml2
+                  (for-each
+                   (lambda (dir)
+                     (for-each (lambda (f)
+                                 (install-file
+                                  f
+                                  (string-append dest-path "/" (dirname f))))
+                               (find-files dir select-rx)))
+                   '("assembly" "common" "eclipse" "epub" "epub3" "fo"
+                     "highlighting" "html" "htmlhelp" "javahelp" "lib"
+                     "manpages" "params" "profiling" "roundtrip"
+                     "template" "website"
+                     "xhtml" "xhtml-1_1" "xhtml5")))))))))
+      (native-inputs (list docbook-xml-4.4  ; for tests
+                           libxml2
                            libxslt
                            perl
                            perl-xml-xpath))
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:58:02 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 6/8] gnu: docbook: Refactor docbook-sgml packages.
Date: Wed, 26 Apr 2023 01:56:58 +0100
* gnu/packages/docbook.scm
(docbook-sgml)[build-system]: Switch to copy-build-system.
[arguments]: Replace #:builder with #:install-plan.
Add phases 'fix-permission and 'patch-iso-entities.
[sources]: Use url-fetch/zipbomb.
(docbook-sgml-4.1, docbook-sgml-3.1)[sources]: Ditto.
(iso-8879-entities)[source]: Ditto.
[build-system]: Switch to copy-build-system.
[native-inputs]: Restyle.
---
 gnu/packages/docbook.scm | 70 ++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 38 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index d4441bacee..cc0a663f68 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -585,35 +585,39 @@ (define-public docbook-sgml-4.2
     (name "docbook-sgml")
     (version "4.2")
     (source (origin
-              (method url-fetch)
+              (method url-fetch/zipbomb)
               (uri (string-append
                     "https://www.oasis-open.org/docbook/sgml/4.2/docbook-"
                     version ".zip"))
               (sha256
                (base32
                 "1hrm4qmmzi285bkxkc74lxvjvw2gbl7ycbaxhv31h9rl9g4x5sv7"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (arguments
-     '(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (iso-entities-dir (string-append
-                                  (assoc-ref %build-inputs "iso-8879-entities")))
-               (unzip  (string-append (assoc-ref %build-inputs "unzip")
-                                      "/bin/unzip"))
-               (dtd    (string-append (assoc-ref %outputs "out")
-                                      "/sgml/dtd/docbook")))
-           ;; Extract the sources.
-           (mkdir-p dtd)
-           (chdir dtd)
-           (invoke unzip source)
-           ;; Reference the ISO 8879 character entities.
-           ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
-           (substitute* "docbook.cat"
-             (("\"iso-(.*)\\.gml\"" _ name)
-              (string-append "\"" iso-entities-dir "/ISO" name "\"")))))))
+     (list
+      #:modules '((guix build copy-build-system)
+                  (guix build utils)
+                  (srfi srfi-26))
+      #:install-plan
+      #~`(("./" "sgml/dtd/docbook"
+           #:exclude-regexp ("catalog\\.xml$"
+                             "ChangeLog$"
+                             "README$"
+                             "\\.txt$")))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-permissions
+            (lambda _
+              (for-each (cut chmod <> #o644) (find-files "."))))
+          (add-before 'install 'patch-iso-entities
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Reference the ISO 8879 character entities.
+              ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
+              (let ((iso-entities-dir
+                     (assoc-ref %build-inputs "iso-8879-entities")))
+                (substitute* "docbook.cat"
+                  (("\"iso-(.*)\\.gml\"" _ name)
+                   (string-append "\"" iso-entities-dir "/ISO" name "\"")))))))))
     (native-inputs
      (list unzip))
     (inputs
@@ -628,7 +632,7 @@ (define-public docbook-sgml-4.1
     (inherit docbook-sgml-4.2)
     (version "4.1")
     (source (origin
-              (method url-fetch)
+              (method url-fetch/zipbomb)
               (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
                                   version "/docbk41.zip"))
               (sha256
@@ -642,7 +646,7 @@ (define-public docbook-sgml-3.1
     (inherit docbook-sgml)
     (version "3.1")
     (source (origin
-              (method url-fetch)
+              (method url-fetch/zipbomb)
               (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
                                   version "/docbk31.zip"))
               (sha256
@@ -655,23 +659,13 @@ (define iso-8879-entities
     (name "iso-8879-entities")
     (version "0.0")                     ;no proper version
     (source (origin
-              (method url-fetch)
-              (uri "http://www.oasis-open.org/cover/ISOEnts.zip")
+              (method url-fetch/zipbomb)
+              (uri "https://www.oasis-open.org/cover/ISOEnts.zip")
               (sha256
                (base32
                 "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
-    (build-system trivial-build-system)
-    (arguments
-     '(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (unzip  (string-append (assoc-ref %build-inputs "unzip")
-                                      "/bin/unzip"))
-               (out (string-append (assoc-ref %outputs "out"))))
-           (invoke unzip source "-d" out)))))
-    (native-inputs `(("unzip" ,unzip)))
+    (build-system copy-build-system)
+    (native-inputs (list unzip))
     (home-page "https://www.oasis-open.org/")
     (synopsis "ISO 8879 character entities")
     (description "ISO 8879 character entities that are typically used in
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:58:03 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 4/8] gnu: docbook-xsl-1.79.1: Refactor package.
Date: Wed, 26 Apr 2023 01:56:56 +0100
* gnu/packages/docbook.scm
(docbook-xsl-1.79.1)[source]: Remove bundled binary files.
[arguments]: Use #:install-plan. Patch catalog.xml using xmlcatalog.
Add phase 'install-doc.
[native-inputs]: Add libxml2.
---
 gnu/packages/docbook.scm | 94 ++++++++++++++++++++++++++--------------
 1 file changed, 61 insertions(+), 33 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 2fe0c2dbc5..b3e53557e8 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -430,44 +430,72 @@ (define-public docbook-xsl-1.79.1
                                   name "-ns-" version ".tar.bz2"))
               (sha256
                (base32
-                "170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))))
+                "170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))
+              (modules '((guix build utils)))
+              ;; Bundled binary files.
+              (snippet
+               #~(delete-file-recursively "tools"))))
     (build-system copy-build-system)
     (outputs '("out" "doc"))
     (arguments
      (list
+      #:install-plan
+      (let ((target (format #f "xml/xsl/~a-~a/" name version))
+            (select-rx '("\\.xml$" "\\.xsl$" "\\.dtd$" "\\.ent$")))
+        #~`(#$@(map
+                (lambda (directory)
+                  ;; XXX: When filters are used, the source basename
+                  ;; isn't kept under the target path, append it again.
+                  (let ((target* (string-append target directory)))
+                    (list directory target* #:include-regexp select-rx)))
+                (list "assembly" "common" "eclipse" "epub" "epub3" "fo"
+                      "highlighting" "html" "htmlhelp" "javahelp" "lib"
+                      "manpages" "params" "profiling" "roundtrip"
+                      "template" "website"
+                      "xhtml" "xhtml-1_1" "xhtml5"))
+            ("catalog.xml" #$target)
+            ("VERSION.xsl" #$target)))
       #:phases
-      #~(modify-phases %standard-phases
-          ;; XXX: The copy-build-system doesn't seem to allow installing to a
-          ;; different output.
-          (replace 'install
-            (lambda _
-              (let ((xml (string-append #$output "/xml/xsl/" #$name "-" #$version))
-                    (doc (string-append #$output:doc
-                                        "/share/doc/" #$name "-" #$version))
-                    (select-rx (make-regexp
-                                "(\\.xml$|\\.xsl$|\\.dtd$|\\.ent$)")))
-                ;; Install catalog.
-                (install-file "catalog.xml" xml)
-                (install-file "VERSION.xsl" xml)
-                (substitute* (string-append xml "/catalog.xml")
-                  (("rewritePrefix=\"./")
-                   (string-append "rewritePrefix=\"file://" xml "/")))
-                ;; Install style sheets.
-                (for-each (lambda (dir)
-                            (for-each (lambda (f)
-                                        (install-file
-                                         f (string-append xml "/" (dirname f))))
-                                      (find-files dir select-rx)))
-                          '("assembly" "common" "eclipse" "epub" "epub3" "fo"
-                            "highlighting" "html" "htmlhelp" "javahelp" "lib"
-                            "manpages" "params" "profiling" "roundtrip"
-                            "template" "website"
-                            "xhtml" "xhtml-1_1" "xhtml5"))
-                ;; Install documentation.
-                (install-file "NEWS" doc)
-                (install-file "RELEASE-NOTES.html" doc)
-                (copy-recursively "slides" doc)
-                (copy-recursively "webhelp" doc)))))))
+      #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a"
+                                 #$output #$name #$version)))
+          (modify-phases %standard-phases
+            (add-before 'install 'patch-catalog-xml
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let ((xmlcatalog (search-input-file inputs
+                                                     "/bin/xmlcatalog"))
+                      (catalog-files (find-files "." "catalog\\.xml$"))
+                      (store-uri (string-append "file://" dest-path "/")))
+                  (for-each
+                   (lambda (catalog)
+                     (for-each
+                      (lambda (type)
+                        ;; Patch /current/ references to point to /gnu/store/….
+                        (invoke xmlcatalog "--noout"
+                                "--add" type
+                                "http://docbook.sourceforge.net/release/xsl-ns/current/"
+                                store-uri
+                                catalog)
+                        ;; Patch versioned references to point to /gnu/store/….
+                        (invoke xmlcatalog "--noout"
+                                "--add" type
+                                (format
+                                 #f "http://docbook.sourceforge.net/release/xsl-ns/~a/"
+                                 #$version)
+                                store-uri
+                                catalog))
+                      (list "rewriteSystem" "rewriteURI")))
+                   catalog-files))))
+            ;; XXX: The copy-build-system doesn't seem to allow installing to a
+            ;; different output.
+            (add-after 'install 'install-doc
+              (lambda _
+                (let ((doc (format #f "~a/share/doc/~a-~a"
+                                   #$output:doc #$name #$version)))
+                  (install-file "NEWS" doc)
+                  (install-file "RELEASE-NOTES.html" doc)
+                  (copy-recursively "slides" doc)
+                  (copy-recursively "webhelp" doc))))))))
+    (native-inputs (list libxml2))
     (home-page "https://docbook.org")
     (synopsis "DocBook XSL namespaced style sheets for document authoring")
     (description "This package provides the @emph{namespaced} XSL style sheets
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:58:03 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 8/8] gnu: docbook-dsssl: Switch to copy-build-system.
Date: Wed, 26 Apr 2023 01:57:00 +0100
* gnu/packages/docbook.scm
(docbook-dsssl)[build-system]: Switch to copy-build-system.
[arguments]: Add phase to install documentation as separate output.
(docbook-dsssl-doc)[build-system]: Switch to copy-build-system.
[arguments]: Adapt to new build-system.
---
 gnu/packages/docbook.scm | 54 ++++++++++++++--------------------------
 1 file changed, 18 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index ced174b3b8..4a911bcec7 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -514,25 +514,22 @@ (define-public docbook-dsssl
               (sha256
                (base32
                 "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (outputs '("out" "doc"))
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (dtd (string-append (assoc-ref %outputs "out")
-                                   "/sgml/dtd/docbook"))
-               (docbook-dsssl-doc (assoc-ref %build-inputs "docbook-dsssl-doc"))
-               (doc (assoc-ref %outputs "doc"))
-               (tar (assoc-ref %build-inputs "tar"))
-               (bzip2 (assoc-ref %build-inputs "bzip2")))
-           (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
-           (mkdir-p dtd)
-           (invoke "tar" "-xf" source "-C" dtd)
-           ;; The doc output contains 1.4 MiB of HTML documentation.
-           (symlink docbook-dsssl-doc doc)))))
+     (list
+      #:install-plan
+      #~`(("./" "sgml/dtd/docbook/"
+           #:exclude ("doc" "docsrc")))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; The doc output contains 1.4 MiB of HTML documentation.
+          (add-after 'install 'install-doc
+            (lambda* (#:key inputs #:allow-other-keys)
+              (mkdir-p (string-append #$output:doc "/share/doc"))
+              (symlink (assoc-ref inputs "docbook-dsssl-doc")
+                       (format #f "~a/share/doc/~a-~a"
+                               #$output:doc #$name #$version)))))))
     (inputs
      (list docbook-dsssl-doc))
     (native-inputs
@@ -555,26 +552,11 @@ (define docbook-dsssl-doc
               (sha256
                (base32
                 "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (docdir (string-append (assoc-ref %outputs "out")
-                                      "/share/doc/" "docbook-dsssl-" ,version))
-               (tar (assoc-ref %build-inputs "tar"))
-               (bzip2 (assoc-ref %build-inputs "bzip2")))
-           (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
-           (mkdir-p docdir)
-           ;; Extract the "doc" subdirectory.
-           (invoke "tar" "-xf" source "--strip-components=2"
-                   "--no-same-owner" "-C" docdir
-                   (string-append "docbook-dsssl-" ,version "/doc"))))))
-    (native-inputs
-     `(("bzip2" ,bzip2)
-       ("tar" ,tar)))
+     (list
+      #:install-plan
+      #~`(("doc/" #$(string-append "/share/doc/docbook-dsssl-" version)))))
     (home-page "https://docbook.org/")
     (synopsis "DocBook DSSSL style sheets documentation")
     (description "Documentation for the DocBook DSSSL style sheets.")
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:58:04 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 7/8] gnu: docbook: Refactor dblatex packages.
Date: Wed, 26 Apr 2023 01:56:59 +0100
* gnu/packages/docbook.scm (dblatex): Rewrite using G-Expressions.
(dblatex/stable): Use modify-inputs.
---
 gnu/packages/docbook.scm | 114 ++++++++++++++++++++-------------------
 1 file changed, 58 insertions(+), 56 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index cc0a663f68..ced174b3b8 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -37,6 +37,7 @@ (define-module (gnu packages docbook)
   #:use-module (gnu packages python)
   #:use-module (gnu packages base)
   #:use-module (gnu packages web-browsers)
+  #:use-module (gnu packages xfig)
   #:use-module (gnu packages xml)
   #:use-module (guix gexp)
   #:use-module (guix utils)
@@ -44,7 +45,6 @@ (define-module (gnu packages docbook)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
-  #:use-module ((guix build utils) #:select (alist-replace))
   #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
@@ -685,62 +685,64 @@ (define-public dblatex
                (base32
                 "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))))
     (build-system python-build-system)
-    ;; TODO: Add xfig/transfig for fig2dev utility
+    (arguments
+     (list
+      ;; Using setuptools causes an invalid "package_base" path in
+      ;; out/bin/.dblatex-real due to a missing leading '/'.  This is caused
+      ;; by dblatex's setup.py stripping the root path when creating the
+      ;; script.  (dblatex's setup.py still uses distutils and thus has to
+      ;; create the script by itself. The feature for creating scripts is one
+      ;; of setuptools' features.)
+      ;; See this thread for details:
+      ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
+      #:use-setuptools? #f
+      #:tests? #f                      ;no 'test' command
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'wrap 'set-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((path (map (lambda (x)
+                                 (string-append (assoc-ref inputs x)
+                                                "/bin"))
+                               (list "libxslt"
+                                     "imagemagick" "inkscape"
+                                     "texlive-updmap.cfg"))))
+                ;; dblatex executes helper programs at runtime.
+                (wrap-program (string-append #$output "/bin/dblatex")
+                  `("PATH" ":" prefix ,path))))))))
     (inputs
-     `(("texlive" ,(texlive-updmap.cfg (list texlive-amsfonts
-                                             texlive-latex-anysize
-                                             texlive-latex-appendix
-                                             texlive-latex-bookmark
-                                             texlive-latex-changebar
-                                             texlive-latex-colortbl
-                                             texlive-latex-fancybox
-                                             texlive-fancyhdr
-                                             texlive-fancyvrb
-                                             texlive-latex-float
-                                             texlive-latex-footmisc
-                                             texlive-hyperref
-                                             texlive-latex-jknapltx
-                                             texlive-listings
-                                             texlive-latex-multirow
-                                             texlive-latex-overpic
-                                             texlive-pdfpages
-                                             texlive-refcount
-                                             texlive-subfigure
-                                             texlive-titlesec
-                                             texlive-wasysym
+     (list (texlive-updmap.cfg (list texlive-amsfonts
+                                     texlive-latex-anysize
+                                     texlive-latex-appendix
+                                     texlive-latex-bookmark
+                                     texlive-latex-changebar
+                                     texlive-latex-colortbl
+                                     texlive-latex-fancybox
+                                     texlive-fancyhdr
+                                     texlive-fancyvrb
+                                     texlive-latex-float
+                                     texlive-latex-footmisc
+                                     texlive-hyperref
+                                     texlive-latex-jknapltx
+                                     texlive-listings
+                                     texlive-latex-multirow
+                                     texlive-latex-overpic
+                                     texlive-pdfpages
+                                     texlive-refcount
+                                     texlive-subfigure
+                                     texlive-titlesec
+                                     texlive-wasysym
 
-                                             texlive-fonts-rsfs
-                                             texlive-stmaryrd
+                                     texlive-fonts-rsfs
+                                     texlive-stmaryrd
 
-                                             texlive-iftex)))
-       ("imagemagick" ,imagemagick)     ;for convert
-       ("inkscape" ,inkscape/stable)    ;for svg conversion
-       ("docbook" ,docbook-xml)
-       ("libxslt" ,libxslt)))           ;for xsltproc
-    (arguments
-     `(;; Using setuptools causes an invalid "package_base" path in
-       ;; out/bin/.dblatex-real due to a missing leading '/'.  This is caused
-       ;; by dblatex's setup.py stripping the root path when creating the
-       ;; script.  (dblatex's setup.py still uses distutils and thus has to
-       ;; create the script by itself. The feature for creating scripts is one
-       ;; of setuptools' features.)
-       ;; See this thread for details:
-       ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
-       #:use-setuptools? #f
-       #:tests? #f                      ;no 'test' command
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'wrap 'set-path
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               ;; dblatex executes helper programs at runtime.
-               (wrap-program (string-append out "/bin/dblatex")
-                 `("PATH" ":" prefix
-                   ,(map (lambda (input)
-                           (string-append (assoc-ref inputs input)
-                                          "/bin"))
-                         '("libxslt" "texlive"
-                           "imagemagick" "inkscape"))))))))))
+                                     texlive-iftex))
+           ;; FIXME: transfig is failing to build.
+           ;;transfig           ;for fig2dev
+           imagemagick        ;for convert
+           inkscape/stable    ;for svg conversion
+           docbook-xml
+           libxslt))          ;for xsltproc
     (home-page "https://dblatex.sourceforge.net")
     (synopsis "DocBook to LaTeX Publishing")
     (description
@@ -759,8 +761,8 @@ (define-public dblatex
 (define-public dblatex/stable
   (hidden-package
    (package/inherit dblatex
-     (inputs (alist-replace "imagemagick" `(,imagemagick/stable)
-                            (package-inputs dblatex))))))
+     (inputs (modify-inputs (package-inputs dblatex)
+               (replace "imagemagick" imagemagick/stable))))))
 
 (define-public docbook-utils
   (package
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 00:58:04 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 5/8] gnu: docbook-utils: Refactor package.
Date: Wed, 26 Apr 2023 01:56:57 +0100
* gnu/packages/docbook.scm (docbook-utils)[description]: Fix description.
[source]: Patch source in snippet.
[arguments]: Remove.
---
 gnu/packages/docbook.scm | 96 ++++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 47 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index b3e53557e8..d4441bacee 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -780,45 +780,40 @@ (define-public docbook-utils
                                   version ".orig.tar.gz"))
               (sha256
                (base32
-                "1scj5vgw1xz872pq54a89blcxqqm11p90yzv8a9mqq57x27apyj8"))))
+                "1scj5vgw1xz872pq54a89blcxqqm11p90yzv8a9mqq57x27apyj8"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   ;; Patch build system.
+                   (substitute* (find-files "." "\\.in$")
+                     ;; Do not hard-code SGML_CATALOG_FILES.
+                     ((".*SGML_CATALOG_FILES=/etc/sgml/catalog.*") "")
+                     ;; Use OpenSP and OpenJade.
+                     (("\\bjade\\b")
+                      "openjade")
+                     (("\\bnsgmls\\b")
+                      "onsgmls"))
+
+                   ;; Do not override the SGML_CATALOG_FILES environment
+                   ;; variable.
+                   (substitute* "bin/jw.in"
+                     ((".*SGML_CATALOG_FILES=`find.*")
+                      "")
+                     (("SGML_CATALOG_FILES=`echo.*")
+                      ":\n")
+                     (("SGML_CATALOG_FILES=\"\"")
+                      ":")
+                     (("\\bwhich\\b")
+                      "command -v"))
+
+                   ;; Locate lynx, links or w3m from the PATH, not from
+                   ;; /usr/bin.
+                   (substitute* "backends/txt"
+                     (("CONVERT=/usr/bin/")
+                      "CONVERT=")
+                     (("\\[ -x /usr/bin/([^ ]+) \\]" _ command)
+                      (format #f "command -v ~a > /dev/null" command)))))))
     (build-system gnu-build-system)
-    (arguments
-     `(#:phases (modify-phases %standard-phases
-                  (add-after 'unpack 'patch-build-system
-                    (lambda _
-                      (substitute* (find-files "." "\\.in$")
-                        ;; Do not hard-code SGML_CATALOG_FILES.
-                        ((".*SGML_CATALOG_FILES=/etc/sgml/catalog.*") "")
-                        ;; Use OpenSP and OpenJade.
-                        (("\\bjade\\b")
-                         "openjade")
-                        (("\\bnsgmls\\b")
-                         "onsgmls"))
-                      #t))
-                  (add-after 'unpack 'patch-jw.in
-                    ;; Do not override the SGML_CATALOG_FILES environment
-                    ;; variable.
-                    (lambda _
-                      (substitute* "bin/jw.in"
-                        ((".*SGML_CATALOG_FILES=`find.*")
-                         "")
-                        (("SGML_CATALOG_FILES=`echo.*")
-                         ":\n")
-                        (("SGML_CATALOG_FILES=\"\"")
-                         ":")
-                        (("\\bwhich\\b")
-                         "command -v"))
-                      #t))
-                  (add-after 'unpack 'patch-txt-backend
-                    (lambda _
-                      ;; Locate lynx, links or w3m from the PATH, not from
-                      ;; /usr/bin.
-                      (substitute* "backends/txt"
-                        (("CONVERT=/usr/bin/")
-                         "CONVERT=")
-                        (("\\[ -x /usr/bin/([^ ]+) \\]" dummy command)
-                         (string-append "command -v " command " > /dev/null")))
-                      #t)))))
     ;; Propagated for convenience.  All these tools are used at run time to
     ;; provide the complete functionality of the docbook-utils commands.
     (propagated-inputs
@@ -839,15 +834,22 @@ (define-public docbook-utils
 Language (HTML), Rich Text Format (RTF), PostScript (PS), man, Portable
 Document Format (PDF), TeX, Texinfo or plain text (txt).  It can be used
 more conveniently via the following wrappers:
-@itemx docbook2dvi Convert a SGML DocBook file to the DVI format.
-@itemx docbook2html Convert a SGML DocBook file to an HTML document.
-@itemx docbook2man Convert a SGML DocBook file a man page.
-@itemx docbook2pdf Convert a SGML DocBook file to a PDF document.
-@itemx docbook2ps Convert a SGML DocBook file to a PS document.
-@itemx docbook2rtf Convert a SGML DocBook file to a RTF document.
-@itemx docbook2tex Convert a SGML DocBook file to a TeX document.
-@itemx docbook2texi Convert a SGML DocBook file to a Texinfo document.
-@itemx docbook2txt Convert a SGML DocBook file to a plain text document.
+@table @command
+@item docbook2dvi
+Convert a SGML DocBook file to the DVI format.
+@item docbook2html
+Convert a SGML DocBook file to an HTML document.
+@item docbook2man
+Convert a SGML DocBook file a man page.
+@item docbook2pdf
+@itemx docbook2ps
+@itemx docbook2rtf
+@itemx docbook2tex
+@itemx docbook2texi
+Convert a SGML DocBook file to a PDF/PS/RTF/TeX document.
+@item docbook2txt
+Convert a SGML DocBook file to a plain text document.
+@end table
 @item sgmldiff
 Detect the differences in markup between two SGML files.
 @end table")
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Wed, 26 Apr 2023 01:16:01 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: 63081 <at> debbugs.gnu.org
Cc: andreas <at> enge.fr, Bruno Victal <mirai <at> makinata.eu>,
 maxim.cournoyer <at> gmail.com
Subject: [PATCH 1/8] gnu: docbook-xml: Fix installation paths.
Date: Wed, 26 Apr 2023 01:56:53 +0100
Using xml/dtd/docbook as installation path had two problems:
* The paths would conflict in profile, which made it impossible
for two different docbook-xml packages to coexist within the XML_CATALOG_FILES
variable.
* It was technically incorrect since non-DTD schemas were also placed here.

This commit makes docbook-xml use versioned paths instead.

* gnu/packages/docbook.scm
(docbook-xml-package, docbook-xml-4.x-package): New procedure.
(docbook-xml): Make docbook-xml an alias for docbook-xml-5.1.
(docbook-xml-5.1): New variable.
(docbook-xml-4.5, docbook-xml-4.4, docbook-xml-4.3, docbook-xml-4.2)
(docbook-xml-4.1.2): Refactor to use docbook-xml-4.x-package procedure.
---
 gnu/packages/docbook.scm | 265 ++++++++++++++++++++++++---------------
 1 file changed, 163 insertions(+), 102 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 070b957339..73a14855b9 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -50,17 +50,17 @@ (define-module (gnu packages docbook)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system python))
 
-(define-public docbook-xml
+;; The fetch-plan, install-plan and phases for docbook-xml tend to vary
+;; between releases therefore we use a “template” package for the
+;; transformations that are common to these packages.
+(define* (docbook-xml-package source version)
+  "Return a package for a docbook-xml package version @var{version} and
+downloading from @var{source}, where @var{version} is a string and
+@var{source} is a @code{<origin>} record."
   (package
     (name "docbook-xml")
-    (version "5.1")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://docbook.org/xml/" version
-                                  "/docbook-v" version "-os.zip"))
-              (sha256
-               (base32
-                "0zqy9prj9wam9dn7v3mgr7ld1axqxdhgrmv06dviwg00ahv43wxk"))))
+    (version version)
+    (source source)
     (build-system copy-build-system)
     (arguments
      (list
@@ -71,23 +71,27 @@ (define-public docbook-xml
       #~(modify-phases %standard-phases
           (add-after 'unpack 'fix-permissions
             (lambda _
-              ;; XXX: These files do not need 0755 permission.
+              ;; These files do not need 0755 permission.
               (for-each (cut chmod <> #o644) (find-files "."))))
           (add-before 'install 'patch-catalog-xml
             (lambda* (#:key inputs #:allow-other-keys)
               (let ((xsltproc (search-input-file inputs "/bin/xsltproc"))
-                    (dtd-path (string-append #$output "/xml/dtd/docbook")))
-                (invoke xsltproc "--nonet" "--noout"
-                        "--stringparam" "prefix" dtd-path
-                        "--output" "catalog.xml.new"
-                        #$(local-file
-                           (search-auxiliary-file "xml/patch-catalog-xml.xsl"))
-                        "catalog.xml")
-                (rename-file "catalog.xml.new" "catalog.xml"))))
-          (replace 'install
-            (lambda _
-              (let ((dtd-path (string-append #$output "/xml/dtd/docbook")))
-                (copy-recursively "." dtd-path)))))))
+                    (xslt-file #$(local-file
+                                  (search-auxiliary-file
+                                   "xml/patch-catalog-xml.xsl")))
+                    ;; Avoid profile conflicts by installing to a
+                    ;; versioned path.
+                    (dest-path
+                     (format #f "~a/xml/docbook/~a" #$output #$version)))
+                (for-each
+                 (lambda (catalog)
+                   (let ((catalog* (string-append catalog ".new")))
+                     (invoke xsltproc "--nonet" "--novalid" "--noout"
+                             "--stringparam" "prefix" dest-path
+                             "--output" catalog*
+                             xslt-file catalog)
+                     (rename-file catalog* catalog)))
+                 (find-files "." "catalog\\.xml$"))))))))
     (native-inputs (list libxslt unzip))
     (home-page "https://docbook.org")
     (synopsis "DocBook XML DTDs for document authoring")
@@ -97,95 +101,152 @@ (define-public docbook-xml
 by no means limited to these applications.)  This package provides XML DTDs.")
     (license (license:x11-style "" "See file headers."))))
 
+(define-public docbook-xml-5.1
+  (let* ((version "5.1")
+         (source (origin
+                   (method url-fetch/zipbomb)
+                   (uri (string-append "https://docbook.org/xml/" version
+                                       "/docbook-v" version "-os.zip"))
+                   (sha256
+                    (base32
+                     "0zqy9prj9wam9dn7v3mgr7ld1axqxdhgrmv06dviwg00ahv43wxk"))))
+         (template (docbook-xml-package source version)))
+    (package
+      (inherit template)
+      (arguments
+       (let ((dest-dir (format #f "xml/docbook/~a/" version)))
+         (substitute-keyword-arguments (package-arguments template)
+           ;; XXX: A default value must be provided otherwise this
+           ;; substitution has no effect.
+           ((#:install-plan _ #f)
+            #~`(("schemas/" #$dest-dir)))))))))
+;; XXX: docbook-xml-4.x versions use the same #:install-plan but since the
+;; paths are versioned we can't use (inherit …).
+(define* (docbook-xml-4.x-package source version)
+  "Return a template for a docbook-xml-4.x package version @var{version} and
+downloading from @var{source}, where @var{version} is a string and
+@var{source} is a @code{<origin>} record."
+  (let ((base-template (docbook-xml-package source version)))
+    (package
+      (inherit base-template)
+      (arguments
+       (let* ((dest-dir (format #f "xml/docbook/~a/" version)))
+         (substitute-keyword-arguments (package-arguments base-template)
+           ((#:phases phases)
+            ;; Some programs, such as kdoctools, instead of using
+            ;; XML_CATALOG_FILES, prefer to use cmake to locate
+            ;; the DTDs for docbook-xml-4.x packages but
+            ;; since there's no agreed standard as to where these files
+            ;; should be placed, in practice the .cmake files
+            ;; end up searching for paths that are distribution specific.
+            #~(modify-phases #$phases
+                (add-after 'install 'symlink-alternate-path
+                  (lambda _
+                    ;; kdoctools searches under xml/dtd/docbook/
+                    ;; which is the convention used by Nix.
+                    (mkdir-p (string-append #$output "/xml/dtd"))
+                    (symlink (string-append #$output "/" #$dest-dir)
+                             (string-append #$output "/xml/dtd/docbook"))))))
+           ((#:install-plan _ #f)
+            #~`(("./" #$dest-dir
+                 #:exclude-regexp ("ChangeLog$"
+                                   "README$"
+                                   "docbook\\.cat$"
+                                   "\\.txt$"))))))))))
+
 (define-public docbook-xml-4.5
-  (package
-    (inherit docbook-xml)
-    (version "4.5")
-    (source (origin
-              (method url-fetch/zipbomb)
-              (uri (string-append "https://docbook.org/xml/" version
-                                  "/docbook-xml-" version ".zip"))
-              (sha256
-               (base32
-                "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))))
+  (let* ((version "4.5")
+         (source (origin
+                   (method url-fetch/zipbomb)
+                   (uri (string-append "https://docbook.org/xml/" version
+                                       "/docbook-xml-" version ".zip"))
+                   (sha256
+                    (base32
+                     "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf")))))
+    (docbook-xml-4.x-package source version)))
 
 (define-public docbook-xml-4.4
-  (package (inherit docbook-xml)
-    (version "4.4")
-    (source (origin
-              (method url-fetch/zipbomb)
-              (uri (string-append "https://docbook.org/xml/" version
-                                  "/docbook-xml-" version ".zip"))
-              (sha256
-               (base32
-                "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
+  (let* ((version "4.4")
+         (source (origin
+                   (method url-fetch/zipbomb)
+                   (uri (string-append "https://docbook.org/xml/" version
+                                       "/docbook-xml-" version ".zip"))
+                   (sha256
+                    (base32
+                     "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82")))))
+    (docbook-xml-4.x-package source version)))
 
 (define-public docbook-xml-4.3
-  (package (inherit docbook-xml)
-    (version "4.3")
-    (source (origin
-              (method url-fetch/zipbomb)
-              (uri (string-append "https://docbook.org/xml/" version
-                                  "/docbook-xml-" version ".zip"))
-              (sha256
-               (base32
-                "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
+  (let* ((version "4.3")
+         (source (origin
+                   (method url-fetch/zipbomb)
+                   (uri (string-append "https://docbook.org/xml/" version
+                                       "/docbook-xml-" version ".zip"))
+                   (sha256
+                    (base32
+                     "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3")))))
+    (docbook-xml-4.x-package source version)))
 
 (define-public docbook-xml-4.2
-  (package (inherit docbook-xml)
-    (version "4.2")
-    (source (origin
-              (method url-fetch/zipbomb)
-              (uri (string-append "https://docbook.org/xml/" version
-                                  "/docbook-xml-" version ".zip"))
-              (sha256
-               (base32
-                "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
+  (let* ((version "4.2")
+         (source (origin
+                   (method url-fetch/zipbomb)
+                   (uri (string-append "https://docbook.org/xml/" version
+                                       "/docbook-xml-" version ".zip"))
+                   (sha256
+                    (base32
+                     "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c")))))
+    (docbook-xml-4.x-package source version)))
 
 (define-public docbook-xml-4.1.2
-  (package
-    (inherit docbook-xml)
-    (version "4.1.2")
-    (source (origin
-              (method url-fetch/zipbomb)
-              (uri (string-append "https://docbook.org/xml/" version
-                                  "/docbkx412.zip"))
-              (sha256
-               (base32
-                "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
-    (arguments
-     (substitute-keyword-arguments (package-arguments docbook-xml)
-       ((#:phases phases)
-        #~(modify-phases #$phases
-            (add-after 'unpack 'copy-catalog-file
-              ;; docbook-xml-4.1.2 is unique in the fact that it doesn't come
-              ;; with a catalog.xml file, requiring it to be generated by hand
-              ;; from the docbook.cat SGML catalog. We could automatically
-              ;; generate it here at the cost of enlarging the package
-              ;; definition with a rudimentary (PEG) parser for the SGML
-              ;; catalog but this is overkill since this file is unlikely to
-              ;; change, therefore we ship a pre-generated catalog.xml.
-              (lambda _
-                (copy-file
-                 #$(local-file
-                    (search-auxiliary-file
-                     "xml/docbook-xml/catalog-4.1.2.xml"))
-                 "catalog.xml")))
-            (add-after 'patch-catalog-xml 'add-rewrite-entries
-              (lambda* (#:key inputs #:allow-other-keys)
-                (let ((xmlcatalog (search-input-file inputs "/bin/xmlcatalog"))
-                      (dtd-path (string-append #$output "/xml/dtd/docbook")))
-                  (for-each
-                   (lambda (type)
-                     (invoke xmlcatalog "--noout"
-                             "--add" type
-                             "http://www.oasis-open.org/docbook/xml/4.1.2/"
-                             (string-append "file://" dtd-path "/")
-                             "catalog.xml"))
-                   (list "rewriteSystem" "rewriteURI")))))))))
-    (native-inputs
-     (modify-inputs (package-native-inputs docbook-xml)
-       (prepend libxml2)))))
+  (let* ((version "4.1.2")
+         (source (origin
+                   (method url-fetch/zipbomb)
+                   (uri (string-append "https://docbook.org/xml/" version
+                                       "/docbkx412.zip"))
+                   (sha256
+                    (base32
+                     "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
+         (template (docbook-xml-4.x-package source version)))
+    (package
+      (inherit template)
+      (arguments
+       (substitute-keyword-arguments (package-arguments template)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'copy-catalog-file
+                ;; docbook-xml-4.1.2 is unique in the fact that it doesn't come
+                ;; with a catalog.xml file, requiring it to be generated by hand
+                ;; from the docbook.cat SGML catalog. We could automatically
+                ;; generate it here at the cost of enlarging the package
+                ;; definition with a rudimentary (PEG) parser for the SGML
+                ;; catalog but this is overkill since this file is unlikely to
+                ;; change, therefore we ship a pre-generated catalog.xml.
+                (lambda _
+                  (copy-file
+                   #$(local-file
+                      (search-auxiliary-file
+                       "xml/docbook-xml/catalog-4.1.2.xml"))
+                   "catalog.xml")))
+              (add-after 'patch-catalog-xml 'add-rewrite-entries
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (let ((xmlcatalog (search-input-file inputs
+                                                       "/bin/xmlcatalog"))
+                        (dtd-path (format #f "~a/xml/docbook/~a"
+                                          #$output #$version)))
+                    (for-each
+                     (lambda (type)
+                       (invoke xmlcatalog "--noout"
+                               "--add" type
+                               "http://www.oasis-open.org/docbook/xml/4.1.2/"
+                               (string-append "file://" dtd-path "/")
+                               "catalog.xml"))
+                     (list "rewriteSystem" "rewriteURI")))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs template)
+         (prepend libxml2))))))
+
+(define-public docbook-xml docbook-xml-5.1)
 
 ;;; There's an issue in docbook-xsl 1.79.2 that causes manpages to be
 ;;; generated incorrectly and embed raw nroff syntax such as '.PP' when there

base-commit: 8093c6ba21c51efe901ba98ce698c545bf13dcd0
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63081; Package guix-patches. (Thu, 27 Jul 2023 16:22:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Bruno Victal <mirai <at> makinata.eu>
Cc: andreas <at> enge.fr, 63081 <at> debbugs.gnu.org
Subject: Re: bug#63081: [PATCH 0/8] Comprehensive DocBook refactoring.
Date: Thu, 27 Jul 2023 12:21:08 -0400
Hi,

Bruno Victal <mirai <at> makinata.eu> writes:

> Notable changes:
> * Fixes profile conflicts for docbook-xml packages by using versioned paths.
> * Implements the path convention used by NixOS for docbook-xml 4.x packages,
> this allows for packages that use cmake to search for these files (such as kdoctools)
> to work correctly without having to patch the sources.
> * Stores the schema files correctly rather than lumping it all within …/dtd/.
> * Source fetching methods were reviewed and were fixed where incorrect. (docbook-xml-5.1)
> * Unbundles binary leftovers in docbook-xsl-1.79.1 packages.
> * Removes executable permissions for SGML DTDs.
> * Uses proper tools to manipulate XML instead of substitute*.
> * Uses sxml instead of representing XML as a string.
> * Fixes tests for docbook-xsl.
> * Uses copy-build-system over trivial-build-system.
> * Modernizes the style used for the package definitions.

I've applied this locally on core-updates and made some cosmetic
changes, but attempting to build the various touched packages led to
this newly introduced elogind failure:

--8<---------------cut here---------------start------------->8---
CMakeFiles/LLVMObjectYAML.dir/yaml2obj.cpp.o
 --xinclude --maxdepth 9000 --stringparam man.output.quietly 1 --stringparam funcsynopsis.style ansi --stringparam man.authors.section.enabled 0 --stringparam man.copyright.section.enabled 0 --stringparam elogind.version 246.10 --path /tmp/guix-build-elogind-246.10.drv-0/build/man:/tmp/guix-build-elogind-246.10.drv-0/source/man ../source/man/custom-man.xsl ../source/man/sd_bus_add_object.xml
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd
../source/man/sd_bus_add_object.xml:3: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
                                                           ^
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd
../source/man/sd_bus_add_match.xml:3: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
                                                           ^
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
../source/man/libelogind-pkgconfig.xml:3: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
                                                           ^
../source/man/sd_bus_add_match.xml:157: element include: XInclude error : could not load ../source/man/libelogind-pkgconfig.xml, and no fallback was found
../source/man/sd_bus_add_object.xml:44: element include: XInclude error : could not load ../source/man/sd_bus_add_match.xml, and no fallback was found
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
../source/man/libelogind-pkgconfig.xml:3: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
                                                           ^
[339/540] Generating man/pam_elogind.8 with a custom command
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd
../source/man/pam_elogind.xml:3: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
                                                           ^
Note: namesp. add : added namespace before processing              pam_elogind
[340/540] Generating man/sd_bus_add_node_enumerator.3 with a custom command
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd
../source/man/sd_bus_add_node_enumerator.xml:3: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
                                                           ^
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
../source/man/libelogind-pkgconfig.xml:3: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
                                                           ^
Note: namesp. add : added namespace before processing              sd_bus_add_node_enumerator
[341/540] Linking target pam_elogind.so
[342/540] Linking target src/shared/libelogind-shared-246.10.so
ninja: build stopped: subcommand failed.
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "ninja" arguments: ("-j" "24") exit-status: 1 term-signal: #f stop-signal: #f> 
phase `build' failed after 12.5 seconds
command "ninja" "-j" "24" failed with status 1
builder for `/gnu/store/836v9khss2hdrzqwwwxm3856la5agzl2-elogind-246.10.drv' failed with exit code 1
@ build-failed /gnu/store/836v9khss2hdrzqwwwxm3856la5agzl2-elogind-246.10.drv - 1 builder for `/gnu/store/836v9khss2hdrzqwwwxm3856la5agzl2-elogind-246.10.drv' failed with exit code 1
--8<---------------cut here---------------end--------------->8---

Would you have an idea of what went wrong here?

-- 
Thanks,
Maxim




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Thu, 10 Aug 2023 14:12:02 GMT) Full text and rfc822 format available.

Notification sent to Bruno Victal <mirai <at> makinata.eu>:
bug acknowledged by developer. (Thu, 10 Aug 2023 14:12:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Bruno Victal <mirai <at> makinata.eu>
Cc: andreas <at> enge.fr, 63081-done <at> debbugs.gnu.org
Subject: Re: [bug#63081] [PATCH 0/8] Comprehensive DocBook refactoring.
Date: Thu, 10 Aug 2023 10:10:51 -0400
Hello Bruno,

Bruno Victal <mirai <at> makinata.eu> writes:

> Notable changes:
> * Fixes profile conflicts for docbook-xml packages by using versioned paths.
> * Implements the path convention used by NixOS for docbook-xml 4.x packages,
> this allows for packages that use cmake to search for these files (such as kdoctools)
> to work correctly without having to patch the sources.
> * Stores the schema files correctly rather than lumping it all within …/dtd/.
> * Source fetching methods were reviewed and were fixed where incorrect. (docbook-xml-5.1)
> * Unbundles binary leftovers in docbook-xsl-1.79.1 packages.
> * Removes executable permissions for SGML DTDs.
> * Uses proper tools to manipulate XML instead of substitute*.
> * Uses sxml instead of representing XML as a string.
> * Fixes tests for docbook-xsl.
> * Uses copy-build-system over trivial-build-system.
> * Modernizes the style used for the package definitions.

I've applied it to core-updates, with some light edits.  If you know of
any packages that could be streamlined thanks to it, please send patches
doing so, marked for core-updates.

Closing for now,

-- 
Thanks,
Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 Sep 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 202 days ago.

Previous Next


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