search-paths: Add $XML_CATALOG_FILES and $SGML_CATALOG_FILES.

These variables are used by some packages for XML/SGML catalog lookups.

* guix/search-paths ($XML_CATALOG_FILES, $SGML_CATALOG_FILES): New variable,
extracted from …
* gnu/packages/xml.scm (libxml2, opensp)[native-search-paths]: … here. Refer
to the variables from (guix search-paths) respectively.
* gnu/packages/perl.scm
(perl-app-xml-docbook-builder)[native-search-paths]: Use $XML_CATALOG_FILES.
* doc/guix.texi (Search Paths): Update documentation to reflect changes.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Bruno Victal 2023-10-09 21:05:50 +01:00 committed by Ludovic Courtès
parent 994fbc0ac6
commit e96fa0b695
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
4 changed files with 49 additions and 35 deletions

View file

@ -11074,17 +11074,14 @@ contain a list of @file{catalog.xml} files (not directories), which are
to be found in @file{xml} sub-directories---nothing less. The search to be found in @file{xml} sub-directories---nothing less. The search
path specification looks like this: path specification looks like this:
@c This is defined at (guix search-paths) as $XML_CATALOG_FILES.
@lisp @lisp
(package (search-path-specification
(name "libxml2") (variable "XML_CATALOG_FILES")
;; some fields omitted (separator " ")
(native-search-paths (files '("xml"))
(list (search-path-specification (file-pattern "^catalog\\.xml$")
(variable "XML_CATALOG_FILES") (file-type 'regular))
(separator " ")
(files '("xml"))
(file-pattern "^catalog\\.xml$")
(file-type 'regular)))))
@end lisp @end lisp
Worry not, search path specifications are usually not this tricky. Worry not, search path specifications are usually not this tricky.
@ -11120,15 +11117,16 @@ The type of file being matched---@code{'directory} or @code{'regular},
though it can be any symbol returned by @code{stat:type} (@pxref{File though it can be any symbol returned by @code{stat:type} (@pxref{File
System, @code{stat},, guile, GNU Guile Reference Manual}). System, @code{stat},, guile, GNU Guile Reference Manual}).
In the libxml2 example above, we would match regular files; in the In the @env{XML_CATALOG_FILES} example above, we would match regular
Python example, we would match directories. files; in the Python example, we would match directories.
@item @code{file-pattern} (default: @code{#f}) @item @code{file-pattern} (default: @code{#f})
This must be either @code{#f} or a regular expression specifying This must be either @code{#f} or a regular expression specifying
files to be matched @emph{within} the sub-directories specified by the files to be matched @emph{within} the sub-directories specified by the
@code{files} field. @code{files} field.
Again, the libxml2 example shows a situation where this is needed. Again, the @env{XML_CATALOG_FILES} example shows a situation where this
is needed.
@end table @end table
@end deftp @end deftp
@ -11136,6 +11134,15 @@ Some search paths are not tied by a single package but to many packages.
To reduce duplications, some of them are pre-defined in @code{(guix To reduce duplications, some of them are pre-defined in @code{(guix
search-paths)}. search-paths)}.
@defvar $SGML_CATALOG_FILES
@defvarx $XML_CATALOG_FILES
These two search paths indicate where the
@url{https://www.oasis-open.org/specs/a401.htm,TR9401 catalog}@footnote{
Alternatively known as SGML catalog.} or
@url{https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html,
XML catalog} files can be found.
@end defvar
@defvar $SSL_CERT_DIR @defvar $SSL_CERT_DIR
@defvarx $SSL_CERT_FILE @defvarx $SSL_CERT_FILE
These two search paths indicate where X.509 certificates can be found These two search paths indicate where X.509 certificates can be found

View file

@ -602,12 +602,7 @@ (define-public perl-app-xml-docbook-builder
(list perl-class-xsaccessor perl-test-trap)) (list perl-class-xsaccessor perl-test-trap))
(native-search-paths (native-search-paths
;; xsltproc's search paths, to avoid propagating libxslt. ;; xsltproc's search paths, to avoid propagating libxslt.
(list (search-path-specification (list $XML_CATALOG_FILES))
(variable "XML_CATALOG_FILES")
(separator " ")
(files '("xml"))
(file-pattern "^catalog\\.xml$")
(file-type 'regular))))
(home-page "https://www.shlomifish.org/open-source/projects/docmake/") (home-page "https://www.shlomifish.org/open-source/projects/docmake/")
(synopsis "Translate DocBook/XML documentation into other file formats") (synopsis "Translate DocBook/XML documentation into other file formats")
(description (description

View file

@ -85,6 +85,7 @@ (define-module (gnu packages xml)
#:use-module (guix build-system python) #:use-module (guix build-system python)
#:use-module (guix deprecation) #:use-module (guix deprecation)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix search-paths)
#:use-module (gnu packages linux) #:use-module (gnu packages linux)
#:use-module (gnu packages pkg-config)) #:use-module (gnu packages pkg-config))
@ -227,14 +228,7 @@ (define-public libxml2
(inputs (list xz)) (inputs (list xz))
(propagated-inputs (list zlib)) ; libxml2.la says '-lz'. (propagated-inputs (list zlib)) ; libxml2.la says '-lz'.
(native-inputs (list perl)) (native-inputs (list perl))
;; $XML_CATALOG_FILES lists 'catalog.xml' files found in under the 'xml' (native-search-paths (list $XML_CATALOG_FILES))
;; sub-directory of any given package.
(native-search-paths (list (search-path-specification
(variable "XML_CATALOG_FILES")
(separator " ")
(files '("xml"))
(file-pattern "^catalog\\.xml$")
(file-type 'regular))))
(search-paths native-search-paths) (search-paths native-search-paths)
(description (description
"Libxml2 is the XML C parser and toolkit developed for the Gnome "Libxml2 is the XML C parser and toolkit developed for the Gnome
@ -1808,14 +1802,7 @@ (define-public opensp
(("^\tOSGMLNORM=`echo osgmlnorm\\|sed '\\$\\(transform\\)'`\\\\") (("^\tOSGMLNORM=`echo osgmlnorm\\|sed '\\$\\(transform\\)'`\\\\")
"\tOSGMLNORM=`echo osgmlnorm|sed '$(transform)'`") "\tOSGMLNORM=`echo osgmlnorm|sed '$(transform)'`")
(("^\t\\$\\(SHELL\\)\n") ""))))))) (("^\t\\$\\(SHELL\\)\n") "")))))))
;; $SGML_CATALOG_FILES lists 'catalog' or 'CATALOG' or '*.cat' files found (native-search-paths (list $SGML_CATALOG_FILES))
;; under the 'sgml' sub-directory of any given package.
(native-search-paths (list (search-path-specification
(variable "SGML_CATALOG_FILES")
(separator ":")
(files '("sgml"))
(file-pattern "^catalog$|^CATALOG$|^.*\\.cat$")
(file-type 'regular))))
(home-page "https://openjade.sourceforge.net/") (home-page "https://openjade.sourceforge.net/")
(synopsis "Suite of SGML/XML processing tools") (synopsis "Suite of SGML/XML processing tools")
(description "OpenSP is an object-oriented toolkit for SGML parsing and (description "OpenSP is an object-oriented toolkit for SGML parsing and

View file

@ -42,6 +42,8 @@ (define-module (guix search-paths)
$SSL_CERT_DIR $SSL_CERT_DIR
$SSL_CERT_FILE $SSL_CERT_FILE
$TZDIR $TZDIR
$SGML_CATALOG_FILES
$XML_CATALOG_FILES
%gcc-search-paths %gcc-search-paths
@ -154,6 +156,29 @@ (define $TZDIR
(files '("share/zoneinfo")) (files '("share/zoneinfo"))
(separator #f))) ;single entry (separator #f))) ;single entry
;; Some packages (notably libxml2) make use of 'XML_CATALOG_FILES'
;; and 'SGML_CATALOG_FILES' for remapping URI references or public/system
;; identifiers to other URI references.
(define $SGML_CATALOG_FILES
;; $SGML_CATALOG_FILES lists 'catalog' or 'CATALOG' or '*.cat' files found
;; under the 'sgml' sub-directory of any given package.
(search-path-specification
(variable "SGML_CATALOG_FILES")
(separator ":")
(files '("sgml"))
(file-pattern "^catalog$|^CATALOG$|^.*\\.cat$")
(file-type 'regular)))
(define $XML_CATALOG_FILES
;; $XML_CATALOG_FILES lists 'catalog.xml' files found in under the 'xml'
;; sub-directory of any given package.
(search-path-specification
(variable "XML_CATALOG_FILES")
(separator " ")
(files '("xml"))
(file-pattern "^catalog\\.xml$")
(file-type 'regular)))
(define (search-path-specification->sexp spec) (define (search-path-specification->sexp spec)
"Return an sexp representing SPEC, a <search-path-specification>. The sexp "Return an sexp representing SPEC, a <search-path-specification>. The sexp
corresponds to the arguments expected by `set-path-environment-variable'." corresponds to the arguments expected by `set-path-environment-variable'."