diff mbox series

[bug#65479,core-updates,04/61] gnu: docbook-xsl: Add compatibility entry.

Message ID ea8bd84b73d478a4cd36a11bb9635159a1f08198.1692830149.git.mirai@makinata.eu
State New
Headers show
Series The Draining of the XML & DocBook Swamp. | expand

Commit Message

Bruno Victal Aug. 23, 2023, 10:34 p.m. UTC
Remap "http://docbook.sourceforge.net/release/xsl-ns/" to
"http://docbook.sourceforge.net/release/xsl/".

* gnu/packages/docbook.scm (docbook-xsl)[arguments]<#:phases>: Add
compatibility entry.
---
 gnu/packages/docbook.scm | 41 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

Comments

Bruno Victal Sept. 16, 2023, 5:03 p.m. UTC | #1
It turns out that we have been inserting incorrect entries in the XML
catalog for docbook-xsl.

The URIs 'http://docbook.sourceforge.net/release/xsl/current/' and 
'http://cdn.docbook.org/release/xsl/current/' are NOT interchangeable [1]
since the docbook-xsl package only provides the namespaced version.

I will prepare a v2 to fix this inaccuracy by adding a docbook-xsl-nons
package and rectify the catalog entries in both packages.


[1]: <https://github.com/docbook/xslt10-stylesheets/issues/201#issuecomment-741549069>
Bruno Victal Sept. 23, 2023, 12:30 p.m. UTC | #2
On 2023-09-16 18:03, Bruno Victal wrote:
> It turns out that we have been inserting incorrect entries in the XML
> catalog for docbook-xsl.
> 
> The URIs 'http://docbook.sourceforge.net/release/xsl/current/' and 
> 'http://cdn.docbook.org/release/xsl/current/' are NOT interchangeable [1]
> since the docbook-xsl package only provides the namespaced version.
> 
> I will prepare a v2 to fix this inaccuracy by adding a docbook-xsl-nons
> package and rectify the catalog entries in both packages.

On second thought I'm leaving this part out from the series as removing the
inaccurate entry will cause every dependent package to fail, though this
is easily fixed by having these packages use the (not yet packaged)
docbook-xsl-nons package.

This means that we're still going to keep using the wrong XSL package but
in practice this hasn't revealed to be a problem for the currently packaged
programs.


PS: I'm leaving it out from this as the series is already getting very large
and addressing the inaccuracy here is better done separately for patch
management reasons.
diff mbox series

Patch

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 4a0104c253..55f99aae62 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -388,7 +388,46 @@  (define-public docbook-xsl
                                   "http://docbook.sourceforge.net/release/xsl/current/"
                                   store-uri
                                   catalog))
-                        (list "rewriteSystem" "rewriteURI")))
+                        (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.
+                       (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))))
             (replace 'install
               (lambda _