unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruno Victal <mirai@makinata.eu>
To: 63081@debbugs.gnu.org
Cc: andreas@enge.fr, Bruno Victal <mirai@makinata.eu>,
	maxim.cournoyer@gmail.com
Subject: [bug#63081] [PATCH 6/8] gnu: docbook: Refactor docbook-sgml packages.
Date: Wed, 26 Apr 2023 01:56:58 +0100	[thread overview]
Message-ID: <26db108569ee144702131e5099081a6ece3978dc.1682470616.git.mirai@makinata.eu> (raw)
In-Reply-To: <aab5207ece8644dc3fc7d88198fc4e3acb5a9337.1682470616.git.mirai@makinata.eu>

* 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





  parent reply	other threads:[~2023-04-26  1:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26  0:52 [bug#63081] [PATCH 0/8] Comprehensive DocBook refactoring Bruno Victal
2023-04-26  0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
2023-04-26  0:56   ` [bug#63081] [PATCH 2/8] gnu: Add docbook-xml-5.0.1 Bruno Victal
2023-04-26  0:56   ` [bug#63081] [PATCH 3/8] gnu: docbook-xsl: Refactor package Bruno Victal
2023-04-26  0:56   ` [bug#63081] [PATCH 4/8] gnu: docbook-xsl-1.79.1: " Bruno Victal
2023-04-26  0:56   ` [bug#63081] [PATCH 5/8] gnu: docbook-utils: " Bruno Victal
2023-04-26  0:56   ` Bruno Victal [this message]
2023-04-26  0:56   ` [bug#63081] [PATCH 7/8] gnu: docbook: Refactor dblatex packages Bruno Victal
2023-04-26  0:57   ` [bug#63081] [PATCH 8/8] gnu: docbook-dsssl: Switch to copy-build-system Bruno Victal
2023-07-27 16:21 ` [bug#63081] [PATCH 0/8] Comprehensive DocBook refactoring Maxim Cournoyer
2023-08-10 14:10 ` bug#63081: " Maxim Cournoyer

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=26db108569ee144702131e5099081a6ece3978dc.1682470616.git.mirai@makinata.eu \
    --to=mirai@makinata.eu \
    --cc=63081@debbugs.gnu.org \
    --cc=andreas@enge.fr \
    --cc=maxim.cournoyer@gmail.com \
    /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).