[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/44: gnu: docbook-xml: Use XSLT to patch catalog.xml.
From: |
guix-commits |
Subject: |
03/44: gnu: docbook-xml: Use XSLT to patch catalog.xml. |
Date: |
Fri, 21 Apr 2023 00:48:22 -0400 (EDT) |
apteryx pushed a commit to branch core-updates
in repository guix.
commit e9ba6d2c47bacae433be1a6c629d4d307206245a
Author: Bruno Victal <mirai@makinata.eu>
AuthorDate: Sat Mar 11 17:54:12 2023 +0000
gnu: docbook-xml: Use XSLT to patch catalog.xml.
(sxml transforms) are unsuited here due to guile-bug #20339.
* gnu/packages/aux-files/xml/patch-catalog-xml.xsl: New file.
* Makefile.am: Register it.
* gnu/packages/docbook.scm (docbook-xml-5)[native-inputs]: Add libxslt.
[arguments]: Add phase to patch catalog.xml using XSLT.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
Makefile.am | 3 ++-
gnu/packages/aux-files/xml/patch-catalog-xml.xsl | 24 ++++++++++++++++++++++++
gnu/packages/docbook.scm | 14 +++++++++++++-
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8c505d8cd3..645026a9ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -436,7 +436,8 @@ AUX_FILES = \
gnu/packages/aux-files/python/sanity-check.py \
gnu/packages/aux-files/python/sitecustomize.py \
gnu/packages/aux-files/renpy/renpy.in \
- gnu/packages/aux-files/run-in-namespace.c
+ gnu/packages/aux-files/run-in-namespace.c \
+ gnu/packages/aux-files/xml/patch-catalog-xml.xsl
# Templates, examples.
EXAMPLES = \
diff --git a/gnu/packages/aux-files/xml/patch-catalog-xml.xsl
b/gnu/packages/aux-files/xml/patch-catalog-xml.xsl
new file mode 100644
index 0000000000..947517476d
--- /dev/null
+++ b/gnu/packages/aux-files/xml/patch-catalog-xml.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+SPDX-FileCopyrightText: 2023 Bruno Victal <mirai@makinata.eu>
+SPDX-License-Identifier: ISC
+
+Fix uri attributes to point to paths in the store.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml"/>
+ <xsl:param name="prefix">/</xsl:param>
+ <!-- begin identity transform -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+ <!-- end identity transform -->
+
+ <xsl:template match="@uri">
+ <xsl:attribute name="uri">
+ <xsl:value-of select="concat('file://', $prefix, '/', .)"/>
+ </xsl:attribute>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 1816b19685..a9c92459c2 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -71,11 +72,22 @@
(lambda _
;; XXX: 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)))))))
- (native-inputs (list unzip))
+ (native-inputs (list libxslt unzip))
(home-page "https://docbook.org")
(synopsis "DocBook XML DTDs for document authoring")
(description
- 32/44: gnu: libgnt: Remove patch-docbook-xml phase., (continued)
- 32/44: gnu: libgnt: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 10/44: gnu: libical: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 43/44: gnu: libnotify: Use gexps and remove input labels., guix-commits, 2023/04/21
- 22/44: gnu: zeitgeist: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 36/44: gnu: asciidoc: Delete trailing #t., guix-commits, 2023/04/21
- 42/44: gnu: plymouth: Delete fix-docbook phase., guix-commits, 2023/04/21
- 40/44: gnu: sysbench: Fix test suite., guix-commits, 2023/04/21
- 37/44: gnu: docbook2x: Use gexps and remove input labels., guix-commits, 2023/04/21
- 30/44: gnu: ibus-minimal: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 02/44: gnu: docbook-xml: Fix permissions., guix-commits, 2023/04/21
- 03/44: gnu: docbook-xml: Use XSLT to patch catalog.xml.,
guix-commits <=
- 04/44: gnu: docbook-xml-4.1.2: Add missing catalog.xml., guix-commits, 2023/04/21
- 13/44: gnu: memphis: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 21/44: gnu: dee: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 11/44: gnu: farstream: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 16/44: gnu: libsigc++-2: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 17/44: gnu: gupnp-igd: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 19/44: gnu: seed: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 15/44: gnu: libsigc++: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 23/44: gnu: libnma: Remove patch-docbook-xml phase., guix-commits, 2023/04/21
- 24/44: gnu: system-config-printer: Remove patch-docbook-xml phase., guix-commits, 2023/04/21