[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#65479] [PATCH core-updates v3 09/63] gnu: docbook-xsl: Add rewrite
From: |
Bruno Victal |
Subject: |
[bug#65479] [PATCH core-updates v3 09/63] gnu: docbook-xsl: Add rewrite entries for http. |
Date: |
Mon, 9 Oct 2023 21:05:57 +0100 |
Refactored 'patch-catalog.xml to reduce code duplication.
The catalog for docbook-xsl hosted on the CDN [1] have entries for the 'http'
scheme yet when building from source only 'https' entries are generated.
Patch the XML catalog to provide them both.
[1]: <https://cdn.docbook.org/release/xsl/current/catalog.xml>
* gnu/packages/docbook.scm (docbook-xsl)[arguments]<#:phases>: Rename
'patch-catalog-xml to 'patch-catalog.xml. Refactor this phase for
deduplication and add 'https' entries.
---
gnu/packages/docbook.scm | 142 +++++++++++++++++----------------------
1 file changed, 60 insertions(+), 82 deletions(-)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index b3b7a37249..a09d356c8a 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -342,93 +342,71 @@ (define-public docbook-xsl
(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
+ (add-after 'generate-catalog.xml 'patch-catalog.xml
+ ;; Note: URI resolutions are not recursive.
+ ;; A rewrite rule from:
+ ;; 'http://docbook.sourceforge.net/release/xsl-ns/'
+ ;; to
+ ;; 'http://docbook.sourceforge.net/release/xsl/'
+ ;; will not trigger the rewrite rule that ultimately
+ ;; remaps to a /gnu/store URI, as can be seen by
+ ;; invoking:
+ ;; $ xmlcatalog "" \
+ ;; 'http://docbook.sourceforge.net/release/xsl-ns/current/'
+ ;; http://docbook.sourceforge.net/release/xsl/current/
+ ;; $ xmlcatalog "" \
+ ;; 'http://docbook.sourceforge.net/release/xsl/current/'
+ ;; file:/gnu/store/…/xml/xsl/…
+ ;;
+ ;; See XML Catalog specification, item 7.2.2. for
+ ;; details.
(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 "/")))
+ (catalog-file "xsl/catalog.xml")
+ (store-uri (string-append "file:" dest-path "/")))
+ ;; Remove /snapshot/ references.
(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"))
-
- ;; Originally the
- ;; "http://docbook.sourceforge.net/release/xsl/"
- ;; URI referred to the non-namespaced docbook-xsl,
- ;; with its namespaced version using a URI differing in
- ;; the path component as '…/xsl-ns/'.
- ;; At some point the namespaced version was made the
- ;; canonical docbook-xsl package whilst preserving the
- ;; original URI.
- ;;
- ;; For compatibility with XML files that still specify
- ;; the legacy namespaced docbook-xsl URIs we re-add them
- ;; here.
+ (lambda (scheme)
+ (invoke xmlcatalog "--noout"
+ "--del"
+ (string-append
+ scheme
+ "://cdn.docbook.org/release/xsl/snapshot/")
+ catalog-file))
+ (list "http" "https"))
+ ;; Rewrite both http:// and https:// URIs.
+ (for-each
+ (lambda (path)
(for-each
- (lambda (type)
- ;; Remap /xsl-ns/ to /xsl/.
- ;; Note: URI resolutions are not recursive.
- ;; A rewrite rule from:
- ;; 'http://docbook.sourceforge.net/release/xsl-ns/'
- ;; to
- ;; 'http://docbook.sourceforge.net/release/xsl/'
- ;; will not trigger the rewrite rule that ultimately
- ;; remaps to a /gnu/store URI, as can be seen by
- ;; invoking:
- ;; $ xmlcatalog "" \
- ;;
'http://docbook.sourceforge.net/release/xsl-ns/current/'
- ;;
http://docbook.sourceforge.net/release/xsl/current/
- ;; $ xmlcatalog "" \
- ;;
'http://docbook.sourceforge.net/release/xsl/current/'
- ;; file://gnu/store/…/xml/xsl/…
- ;;
- ;; See XML Catalog specification, item 7.2.2. for
- ;; details.
- (invoke xmlcatalog "--noout"
- "--add" type
-
"http://docbook.sourceforge.net/release/xsl-ns/current/"
- store-uri
- catalog))
- (list "rewriteSystem" "rewriteURI")))
- catalog-files))))
+ (lambda (scheme)
+ (for-each
+ (lambda (entry-type)
+ (let ((uri (string-append scheme "://" path)))
+ (invoke xmlcatalog "--noout"
+ "--add" entry-type uri store-uri
+ catalog-file)))
+ (list "rewriteSystem" "rewriteURI")))
+ (list "http" "https")))
+ (list #$(format #f "cdn.docbook.org/release/xsl/~a/"
+ base-version)
+ "cdn.docbook.org/release/xsl/current/"
+ ;; Re-add the no longer present compatibility
entries for
+ ;; v.1.79.1 or earlier URIs.
+ "docbook.sourceforge.net/release/xsl/current/"
+ ;; Originally the
+ ;; "http://docbook.sourceforge.net/release/xsl/"
+ ;; URI referred to the non-namespaced docbook-xsl,
+ ;; with its namespaced version using a URI
differing in
+ ;; the path component as '…/xsl-ns/'.
+ ;; At some point the namespaced version was made the
+ ;; canonical docbook-xsl package whilst preserving
the
+ ;; original URI.
+ ;;
+ ;; For compatibility with XML files that still
specify
+ ;; the legacy namespaced docbook-xsl URIs we re-add
them
+ ;; here.
+
"docbook.sourceforge.net/release/xsl-ns/current/")))))
(replace 'install
(lambda _
(let ((select-rx (make-regexp
--
2.41.0
- [bug#65479] [PATCH core-updates v3 00/63] Docbook & XML/SGML improvements, Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 01/63] Partial revert d3a0869e9b667d563e7e877c93f30a70896c5831., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 15/63] gnu: docbook2x: Set search-paths for XML and SGML catalogs., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 03/63] gnu: libxml2: Add SGML_CATALOG_FILES to native-search-path., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 09/63] gnu: docbook-xsl: Add rewrite entries for http.,
Bruno Victal <=
- [bug#65479] [PATCH core-updates v3 07/63] gnu: docbook-xml-5.1: Fix URIs in catalog.xml., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 05/63] gnu: docbook-xml: Fix installation paths., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 33/63] gnu: gtk: Drop docbook workaround., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 17/63] gnu: libxml2: Rewrite using G-Expressions., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 06/63] gnu: Add docbook-xml-5.0.1., Bruno Victal, 2023/10/09
- [bug#65479] [PATCH core-updates v3 02/63] search-paths: Add $XML_CATALOG_FILES and $SGML_CATALOG_FILES., Bruno Victal, 2023/10/09