Message ID | a76f2d756fb08e9d629b72b839dd20103937c973.1695478390.git.mirai@makinata.eu |
---|---|
State | New |
Headers | show |
Series | Docbook & XML/SGML improvements. | expand |
Hi, A naive question. :-) On Sat, 23 Sep 2023 at 15:19, Bruno Victal <mirai@makinata.eu> wrote: > diff --git a/doc/guix.texi b/doc/guix.texi > index 346af01e9d..5e7df75976 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -11132,17 +11132,14 @@ Search Paths > to be found in @file{xml} sub-directories---nothing less. The search > path specification looks like this: > > +@c This is defined at (guix search-paths) as $XML_CATALOG_FILES. > @lisp > -(package > - (name "libxml2") > - ;; some fields omitted > - (native-search-paths > - (list (search-path-specification > - (variable "XML_CATALOG_FILES") > - (separator " ") > - (files '("xml")) > - (file-pattern "^catalog\\.xml$") > - (file-type 'regular))))) > +(search-path-specification > + (variable "XML_CATALOG_FILES") > + (separator " ") > + (files '("xml")) > + (file-pattern "^catalog\\.xml$") > + (file-type 'regular)) > @end lisp I do not see much the difference, except the ’package’ part. [...] > diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm > index 8b82c272fc..267a35e560 100644 > --- a/gnu/packages/perl.scm > +++ b/gnu/packages/perl.scm > @@ -601,12 +601,7 @@ (define-public perl-app-xml-docbook-builder > (list perl-class-xsaccessor perl-test-trap)) > (native-search-paths > ;; xsltproc's search paths, to avoid propagating libxslt. > - (list (search-path-specification > - (variable "XML_CATALOG_FILES") > - (separator " ") > - (files '("xml")) > - (file-pattern "^catalog\\.xml$") > - (file-type 'regular)))) > + (list $XML_CATALOG_FILES)) And here that’s not the new example from the manual. Somehow, the way using ’(search-path-specification (variable "XML_CATALOG_FILES") …) seems documented but not (list $XML_CATALOG_FILES). And that is confusing me. > diff --git a/guix/search-paths.scm b/guix/search-paths.scm > index 8dc81861c9..752dc8099b 100644 > --- a/guix/search-paths.scm > +++ b/guix/search-paths.scm > @@ -38,6 +38,8 @@ (define-module (guix search-paths) > $SSL_CERT_DIR > $SSL_CERT_FILE > $TZDIR > + $SGML_CATALOG_FILES > + $XML_CATALOG_FILES [...] > +;; 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))) Well, somehow the manual should provide an example using, (search-path-specification (variable "SOMETHING_RELEVANT") (separator " ") (files '("foo")) (file-pattern "^catalog\\.bar$") (file-type 'regular)) instead of the one using XML_CATALOG_FILES, especially if this former is now replaced by the shorthand $XML_CATALOG_FILES. Else, I am confused. Cheers, simon
Hi Simon, On 2023-09-25 09:00, Simon Tournier wrote: > And here that’s not the new example from the manual. Somehow, the way > using ’(search-path-specification (variable "XML_CATALOG_FILES") …) > seems documented but not (list $XML_CATALOG_FILES). And that is > confusing me. […] >> +(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))) > > Well, somehow the manual should provide an example using, > > (search-path-specification > (variable "SOMETHING_RELEVANT") > (separator " ") > (files '("foo")) > (file-pattern "^catalog\\.bar$") > (file-type 'regular)) > > instead of the one using XML_CATALOG_FILES, especially if this former is > now replaced by the shorthand $XML_CATALOG_FILES. Else, I am confused. Right, I think I can see the potential for misunderstanding with the updated doc section. I'll address it in a v3 after giving some time for others to chime in with the remainder of the series.
diff --git a/doc/guix.texi b/doc/guix.texi index 346af01e9d..5e7df75976 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11132,17 +11132,14 @@ Search Paths to be found in @file{xml} sub-directories---nothing less. The search path specification looks like this: +@c This is defined at (guix search-paths) as $XML_CATALOG_FILES. @lisp -(package - (name "libxml2") - ;; some fields omitted - (native-search-paths - (list (search-path-specification - (variable "XML_CATALOG_FILES") - (separator " ") - (files '("xml")) - (file-pattern "^catalog\\.xml$") - (file-type 'regular))))) +(search-path-specification + (variable "XML_CATALOG_FILES") + (separator " ") + (files '("xml")) + (file-pattern "^catalog\\.xml$") + (file-type 'regular)) @end lisp Worry not, search path specifications are usually not this tricky. @@ -11178,15 +11175,16 @@ Search Paths though it can be any symbol returned by @code{stat:type} (@pxref{File System, @code{stat},, guile, GNU Guile Reference Manual}). -In the libxml2 example above, we would match regular files; in the -Python example, we would match directories. +In the @env{XML_CATALOG_FILES} example above, we would match regular +files; in the Python example, we would match directories. @item @code{file-pattern} (default: @code{#f}) This must be either @code{#f} or a regular expression specifying files to be matched @emph{within} the sub-directories specified by the @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 deftp diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm index 8b82c272fc..267a35e560 100644 --- a/gnu/packages/perl.scm +++ b/gnu/packages/perl.scm @@ -601,12 +601,7 @@ (define-public perl-app-xml-docbook-builder (list perl-class-xsaccessor perl-test-trap)) (native-search-paths ;; xsltproc's search paths, to avoid propagating libxslt. - (list (search-path-specification - (variable "XML_CATALOG_FILES") - (separator " ") - (files '("xml")) - (file-pattern "^catalog\\.xml$") - (file-type 'regular)))) + (list $XML_CATALOG_FILES)) (home-page "https://www.shlomifish.org/open-source/projects/docmake/") (synopsis "Translate DocBook/XML documentation into other file formats") (description diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm index c0222f5518..75a14d0824 100644 --- a/gnu/packages/xml.scm +++ b/gnu/packages/xml.scm @@ -83,6 +83,7 @@ (define-module (gnu packages xml) #:use-module (guix build-system python) #:use-module (guix deprecation) #:use-module (guix utils) + #:use-module (guix search-paths) #:use-module (gnu packages linux) #:use-module (gnu packages pkg-config)) @@ -225,14 +226,7 @@ (define-public libxml2 (inputs (list xz)) (propagated-inputs (list zlib)) ; libxml2.la says '-lz'. (native-inputs (list perl)) - ;; $XML_CATALOG_FILES lists 'catalog.xml' files found in under the 'xml' - ;; 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)))) + (native-search-paths (list $XML_CATALOG_FILES)) (search-paths native-search-paths) (description "Libxml2 is the XML C parser and toolkit developed for the Gnome @@ -1787,14 +1781,7 @@ (define-public opensp (("^\tOSGMLNORM=`echo osgmlnorm\\|sed '\\$\\(transform\\)'`\\\\") "\tOSGMLNORM=`echo osgmlnorm|sed '$(transform)'`") (("^\t\\$\\(SHELL\\)\n") ""))))))) - ;; $SGML_CATALOG_FILES lists 'catalog' or 'CATALOG' or '*.cat' files found - ;; 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)))) + (native-search-paths (list $SGML_CATALOG_FILES)) (home-page "https://openjade.sourceforge.net/") (synopsis "Suite of SGML/XML processing tools") (description "OpenSP is an object-oriented toolkit for SGML parsing and diff --git a/guix/search-paths.scm b/guix/search-paths.scm index 8dc81861c9..752dc8099b 100644 --- a/guix/search-paths.scm +++ b/guix/search-paths.scm @@ -38,6 +38,8 @@ (define-module (guix search-paths) $SSL_CERT_DIR $SSL_CERT_FILE $TZDIR + $SGML_CATALOG_FILES + $XML_CATALOG_FILES search-path-specification->sexp sexp->search-path-specification @@ -121,6 +123,29 @@ (define $TZDIR (files '("share/zoneinfo")) (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) "Return an sexp representing SPEC, a <search-path-specification>. The sexp corresponds to the arguments expected by `set-path-environment-variable'."