mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
gnu: docbook-xml: Fix installation paths.
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. Additionally the store URI for docbook-xml-4.1.2 was adjusted to conform to RFC8089 as according to RFC1738 the double slash "//" is intended for schemes that involve the direct use of an IP-based protocol. * 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. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
ec28ce00fd
commit
22b50e65c5
1 changed files with 163 additions and 102 deletions
|
@ -50,17 +50,17 @@ (define-module (gnu packages docbook)
|
||||||
#:use-module (guix build-system trivial)
|
#:use-module (guix build-system trivial)
|
||||||
#:use-module (guix build-system python))
|
#: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
|
(package
|
||||||
(name "docbook-xml")
|
(name "docbook-xml")
|
||||||
(version "5.1")
|
(version version)
|
||||||
(source (origin
|
(source source)
|
||||||
(method url-fetch)
|
|
||||||
(uri (string-append "https://docbook.org/xml/" version
|
|
||||||
"/docbook-v" version "-os.zip"))
|
|
||||||
(sha256
|
|
||||||
(base32
|
|
||||||
"0zqy9prj9wam9dn7v3mgr7ld1axqxdhgrmv06dviwg00ahv43wxk"))))
|
|
||||||
(build-system copy-build-system)
|
(build-system copy-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
(list
|
(list
|
||||||
|
@ -71,23 +71,27 @@ (define-public docbook-xml
|
||||||
#~(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'fix-permissions
|
(add-after 'unpack 'fix-permissions
|
||||||
(lambda _
|
(lambda _
|
||||||
;; XXX: These files do not need 0755 permission.
|
;; These files do not need 0755 permission.
|
||||||
(for-each (cut chmod <> #o644) (find-files "."))))
|
(for-each (cut chmod <> #o644) (find-files "."))))
|
||||||
(add-before 'install 'patch-catalog-xml
|
(add-before 'install 'patch-catalog-xml
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
(let ((xsltproc (search-input-file inputs "/bin/xsltproc"))
|
(let ((xsltproc (search-input-file inputs "/bin/xsltproc"))
|
||||||
(dtd-path (string-append #$output "/xml/dtd/docbook")))
|
(xslt-file #$(local-file
|
||||||
(invoke xsltproc "--nonet" "--noout"
|
(search-auxiliary-file
|
||||||
"--stringparam" "prefix" dtd-path
|
"xml/patch-catalog-xml.xsl")))
|
||||||
"--output" "catalog.xml.new"
|
;; Avoid profile conflicts by installing to a
|
||||||
#$(local-file
|
;; versioned path.
|
||||||
(search-auxiliary-file "xml/patch-catalog-xml.xsl"))
|
(dest-path
|
||||||
"catalog.xml")
|
(format #f "~a/xml/docbook/~a" #$output #$version)))
|
||||||
(rename-file "catalog.xml.new" "catalog.xml"))))
|
(for-each
|
||||||
(replace 'install
|
(lambda (catalog)
|
||||||
(lambda _
|
(let ((catalog* (string-append catalog ".new")))
|
||||||
(let ((dtd-path (string-append #$output "/xml/dtd/docbook")))
|
(invoke xsltproc "--nonet" "--novalid" "--noout"
|
||||||
(copy-recursively "." dtd-path)))))))
|
"--stringparam" "prefix" dest-path
|
||||||
|
"--output" catalog*
|
||||||
|
xslt-file catalog)
|
||||||
|
(rename-file catalog* catalog)))
|
||||||
|
(find-files "." "catalog\\.xml$"))))))))
|
||||||
(native-inputs (list libxslt unzip))
|
(native-inputs (list libxslt unzip))
|
||||||
(home-page "https://docbook.org")
|
(home-page "https://docbook.org")
|
||||||
(synopsis "DocBook XML DTDs for document authoring")
|
(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.")
|
by no means limited to these applications.) This package provides XML DTDs.")
|
||||||
(license (license:x11-style "" "See file headers."))))
|
(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
|
(define-public docbook-xml-4.5
|
||||||
(package
|
(let* ((version "4.5")
|
||||||
(inherit docbook-xml)
|
(source (origin
|
||||||
(version "4.5")
|
(method url-fetch/zipbomb)
|
||||||
(source (origin
|
(uri (string-append "https://docbook.org/xml/" version
|
||||||
(method url-fetch/zipbomb)
|
"/docbook-xml-" version ".zip"))
|
||||||
(uri (string-append "https://docbook.org/xml/" version
|
(sha256
|
||||||
"/docbook-xml-" version ".zip"))
|
(base32
|
||||||
(sha256
|
"1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf")))))
|
||||||
(base32
|
(docbook-xml-4.x-package source version)))
|
||||||
"1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))))
|
|
||||||
|
|
||||||
(define-public docbook-xml-4.4
|
(define-public docbook-xml-4.4
|
||||||
(package (inherit docbook-xml)
|
(let* ((version "4.4")
|
||||||
(version "4.4")
|
(source (origin
|
||||||
(source (origin
|
(method url-fetch/zipbomb)
|
||||||
(method url-fetch/zipbomb)
|
(uri (string-append "https://docbook.org/xml/" version
|
||||||
(uri (string-append "https://docbook.org/xml/" version
|
"/docbook-xml-" version ".zip"))
|
||||||
"/docbook-xml-" version ".zip"))
|
(sha256
|
||||||
(sha256
|
(base32
|
||||||
(base32
|
"141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82")))))
|
||||||
"141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
|
(docbook-xml-4.x-package source version)))
|
||||||
|
|
||||||
(define-public docbook-xml-4.3
|
(define-public docbook-xml-4.3
|
||||||
(package (inherit docbook-xml)
|
(let* ((version "4.3")
|
||||||
(version "4.3")
|
(source (origin
|
||||||
(source (origin
|
(method url-fetch/zipbomb)
|
||||||
(method url-fetch/zipbomb)
|
(uri (string-append "https://docbook.org/xml/" version
|
||||||
(uri (string-append "https://docbook.org/xml/" version
|
"/docbook-xml-" version ".zip"))
|
||||||
"/docbook-xml-" version ".zip"))
|
(sha256
|
||||||
(sha256
|
(base32
|
||||||
(base32
|
"0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3")))))
|
||||||
"0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
|
(docbook-xml-4.x-package source version)))
|
||||||
|
|
||||||
(define-public docbook-xml-4.2
|
(define-public docbook-xml-4.2
|
||||||
(package (inherit docbook-xml)
|
(let* ((version "4.2")
|
||||||
(version "4.2")
|
(source (origin
|
||||||
(source (origin
|
(method url-fetch/zipbomb)
|
||||||
(method url-fetch/zipbomb)
|
(uri (string-append "https://docbook.org/xml/" version
|
||||||
(uri (string-append "https://docbook.org/xml/" version
|
"/docbook-xml-" version ".zip"))
|
||||||
"/docbook-xml-" version ".zip"))
|
(sha256
|
||||||
(sha256
|
(base32
|
||||||
(base32
|
"18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c")))))
|
||||||
"18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
|
(docbook-xml-4.x-package source version)))
|
||||||
|
|
||||||
(define-public docbook-xml-4.1.2
|
(define-public docbook-xml-4.1.2
|
||||||
(package
|
(let* ((version "4.1.2")
|
||||||
(inherit docbook-xml)
|
(source (origin
|
||||||
(version "4.1.2")
|
(method url-fetch/zipbomb)
|
||||||
(source (origin
|
(uri (string-append "https://docbook.org/xml/" version
|
||||||
(method url-fetch/zipbomb)
|
"/docbkx412.zip"))
|
||||||
(uri (string-append "https://docbook.org/xml/" version
|
(sha256
|
||||||
"/docbkx412.zip"))
|
(base32
|
||||||
(sha256
|
"0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
|
||||||
(base32
|
(template (docbook-xml-4.x-package source version)))
|
||||||
"0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
|
(package
|
||||||
(arguments
|
(inherit template)
|
||||||
(substitute-keyword-arguments (package-arguments docbook-xml)
|
(arguments
|
||||||
((#:phases phases)
|
(substitute-keyword-arguments (package-arguments template)
|
||||||
#~(modify-phases #$phases
|
((#:phases phases)
|
||||||
(add-after 'unpack 'copy-catalog-file
|
#~(modify-phases #$phases
|
||||||
;; docbook-xml-4.1.2 is unique in the fact that it doesn't come
|
(add-after 'unpack 'copy-catalog-file
|
||||||
;; with a catalog.xml file, requiring it to be generated by hand
|
;; docbook-xml-4.1.2 is unique in the fact that it doesn't come
|
||||||
;; from the docbook.cat SGML catalog. We could automatically
|
;; with a catalog.xml file, requiring it to be generated by hand
|
||||||
;; generate it here at the cost of enlarging the package
|
;; from the docbook.cat SGML catalog. We could automatically
|
||||||
;; definition with a rudimentary (PEG) parser for the SGML
|
;; generate it here at the cost of enlarging the package
|
||||||
;; catalog but this is overkill since this file is unlikely to
|
;; definition with a rudimentary (PEG) parser for the SGML
|
||||||
;; change, therefore we ship a pre-generated catalog.xml.
|
;; catalog but this is overkill since this file is unlikely to
|
||||||
(lambda _
|
;; change, therefore we ship a pre-generated catalog.xml.
|
||||||
(copy-file
|
(lambda _
|
||||||
#$(local-file
|
(copy-file
|
||||||
(search-auxiliary-file
|
#$(local-file
|
||||||
"xml/docbook-xml/catalog-4.1.2.xml"))
|
(search-auxiliary-file
|
||||||
"catalog.xml")))
|
"xml/docbook-xml/catalog-4.1.2.xml"))
|
||||||
(add-after 'patch-catalog-xml 'add-rewrite-entries
|
"catalog.xml")))
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(add-after 'patch-catalog-xml 'add-rewrite-entries
|
||||||
(let ((xmlcatalog (search-input-file inputs "/bin/xmlcatalog"))
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
(dtd-path (string-append #$output "/xml/dtd/docbook")))
|
(let ((xmlcatalog (search-input-file inputs
|
||||||
(for-each
|
"/bin/xmlcatalog"))
|
||||||
(lambda (type)
|
(dtd-path (format #f "~a/xml/docbook/~a"
|
||||||
(invoke xmlcatalog "--noout"
|
#$output #$version)))
|
||||||
"--add" type
|
(for-each
|
||||||
"http://www.oasis-open.org/docbook/xml/4.1.2/"
|
(lambda (type)
|
||||||
(string-append "file://" dtd-path "/")
|
(invoke xmlcatalog "--noout"
|
||||||
"catalog.xml"))
|
"--add" type
|
||||||
(list "rewriteSystem" "rewriteURI")))))))))
|
"http://www.oasis-open.org/docbook/xml/4.1.2/"
|
||||||
(native-inputs
|
(string-append "file:" dtd-path "/")
|
||||||
(modify-inputs (package-native-inputs docbook-xml)
|
"catalog.xml"))
|
||||||
(prepend libxml2)))))
|
(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
|
;;; 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
|
;;; generated incorrectly and embed raw nroff syntax such as '.PP' when there
|
||||||
|
|
Loading…
Reference in a new issue