[libvirt] [PATCH] docs: make the location of the xml catalog file a configure option

The default location for the XML catalog file, /etc/xml/catalog, used when validating the generated html docs, isn't correct for MacOS X. This commit adds an option to the configure script, allowing the default to be overridden: --with-xml-catalog-file=/path/to/xml/catalog/file --- Tested on MacOS X 10.6 (using overridden locatin), and Fedora 13 (using the default location). Works fine on both. configure.ac | 17 ++++++++++++----- docs/Makefile.am | 10 ++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index e41f2b5..153fa1f 100644 --- a/configure.ac +++ b/configure.ac @@ -171,6 +171,12 @@ AC_ARG_WITH([html-subdir], [AC_HELP_STRING([--with-html-subdir=path], [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"]) AC_SUBST([HTML_DIR]) +dnl Specific XML catalog file for validation of generated html +AC_ARG_WITH([xml-catalog-file], [AC_HELP_STRING([--with-xml-catalog-file=path], + [path to XML catalog file for validating generated html, default /etc/xml/catalog])], + [XML_CATALOG_FILE=$withval], [XML_CATALOG_FILE='/etc/xml/catalog']) +AC_SUBST([XML_CATALOG_FILE]) + dnl if --prefix is /usr, don't use /usr/var for localstatedir dnl or /usr/etc for sysconfdir dnl as this makes a lot of things break in testing situations @@ -2416,11 +2422,12 @@ AC_MSG_NOTICE([ Alloc OOM: $enable_oom]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([Miscellaneous]) AC_MSG_NOTICE([]) -AC_MSG_NOTICE([ Debug: $enable_debug]) -AC_MSG_NOTICE([ Warnings: $enable_compile_warnings]) -AC_MSG_NOTICE([ Readline: $lv_use_readline]) -AC_MSG_NOTICE([ Python: $with_python]) -AC_MSG_NOTICE([ DTrace: $with_dtrace]) +AC_MSG_NOTICE([ Debug: $enable_debug]) +AC_MSG_NOTICE([ Warnings: $enable_compile_warnings]) +AC_MSG_NOTICE([ Readline: $lv_use_readline]) +AC_MSG_NOTICE([ Python: $with_python]) +AC_MSG_NOTICE([ DTrace: $with_dtrace]) +AC_MSG_NOTICE([ XML Catalog: $XML_CATALOG_FILE]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([Privileges]) AC_MSG_NOTICE([]) diff --git a/docs/Makefile.am b/docs/Makefile.am index ae13c46..27804a2 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -118,10 +118,11 @@ todo: %.html: %.html.tmp @if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ - if $(XMLCATALOG) /etc/xml/catalog \ + if $(XMLCATALOG) $(XML_CATALOG_FILE) \ "-//W3C//DTD XHTML 1.0 Strict//EN" > /dev/null ; then \ echo "Validating $@" ; \ - $(XMLLINT) --nonet --format --valid $< > $@ \ + SGML_CATALOG_FILES=$(XML_CATALOG_FILE) \ + $(XMLLINT) --catalogs --nonet --format --valid $< > $@ \ || { rm $@ && exit 1; }; \ else echo "missing XHTML1 DTD" ; fi ; fi @@ -131,10 +132,11 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in echo "Rebuilding the HTML pages from the XML API" ; \ $(XSLTPROC) --nonet $(srcdir)/newapi.xsl libvirt-api.xml ; fi -@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ - if $(XMLCATALOG) /etc/xml/catalog "-//W3C//DTD XHTML 1.0 Strict//EN" \ + if $(XMLCATALOG) $(XML_CATALOG_FILE) "-//W3C//DTD XHTML 1.0 Strict//EN" \ > /dev/null ; then \ echo "Validating the resulting XHTML pages" ; \ - $(XMLLINT) --nonet --valid --noout html/*.html ; \ + SGML_CATALOG_FILES=$(XML_CATALOG_FILE) \ + $(XMLLINT) --catalogs --nonet --valid --noout html/*.html ; \ else echo "missing XHTML1 DTD" ; fi ; fi $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl) -- 1.7.3

On 10/24/2010 01:39 AM, Justin Clift wrote:
The default location for the XML catalog file, /etc/xml/catalog, used when validating the generated html docs, isn't correct for MacOS X.
This commit adds an option to the configure script, allowing the default to be overridden:
--with-xml-catalog-file=/path/to/xml/catalog/file --- Tested on MacOS X 10.6 (using overridden locatin), and Fedora 13 (using the default location). Works fine on both.
ACK with two nits:
+dnl Specific XML catalog file for validation of generated html +AC_ARG_WITH([xml-catalog-file], [AC_HELP_STRING([--with-xml-catalog-file=path], + [path to XML catalog file for validating generated html, default /etc/xml/catalog])],
this line is long; you can put arbitrary line breaks in the second argument to AC_HELP_STRING, and autoconf will automatically re-fill the line to 80 columns in the ./configure --help output. So, to avoid a long line, just do: AC_ARG_WITH([xml-catalog-file], [AC_HELP_STRING([--with-xml-catalog-file=path], [path to XML catalog file for validating generated html, default /etc/xml/catalog])], [XML_CATALOG_FILE=$withval], [XML_CATALOG_FILE='/etc/xml/catalog'])
%.html: %.html.tmp @if test -x $(XMLLINT)&& test -x $(XMLCATALOG) ; then \ - if $(XMLCATALOG) /etc/xml/catalog \ + if $(XMLCATALOG) $(XML_CATALOG_FILE) \
Should we worry about potential whitespace in $(XML_CATALOG_FILE)? That is, except for single quote, we can make this more robust by using: if $(XMLCATALOG) '$(XML_CATALOG_FILE)' and so forth for all Makefile references to this variable. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 10/26/2010 08:24 AM, Eric Blake wrote:
On 10/24/2010 01:39 AM, Justin Clift wrote:
The default location for the XML catalog file, /etc/xml/catalog, used when validating the generated html docs, isn't correct for MacOS X. <snip> ACK with two nits:
Thanks Eric, pushed. Addressed both nits, getting the line length in order, and quoting the XML_CATALOG_FILE variable in the Makefile.am. Tested it on OSX with the xml catalog file in a directory with spaces, and it worked with no worries. :)

On Sun, Oct 24, 2010 at 06:39:03PM +1100, Justin Clift wrote:
The default location for the XML catalog file, /etc/xml/catalog, used when validating the generated html docs, isn't correct for MacOS X.
Grumpf, how in hell did they break this ? /etc/xml/catalog is the result of a long fight a decade or so ago, one could have expected them to accept the output of the 'discussion' done in the Linux community.
This commit adds an option to the configure script, allowing the default to be overridden:
ACK on adding the option, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 10/27/2010 12:39 AM, Daniel Veillard wrote:
On Sun, Oct 24, 2010 at 06:39:03PM +1100, Justin Clift wrote:
The default location for the XML catalog file, /etc/xml/catalog, used when validating the generated html docs, isn't correct for MacOS X.
Grumpf, how in hell did they break this ? /etc/xml/catalog is the result of a long fight a decade or so ago, one could have expected them to accept the output of the 'discussion' done in the Linux community.
Heh, yeah, I can see how that would look. :) One of the main goals for the Homebrew system, seems to be to allow multiple users to each have their own choices of packages installed (over what's provided by the system itself). They're also big on it being flexible enough for a user to have multiple complete parallel installs too. Kind of like: /home/fred/mypackages/ /home/john/mypackages/ /home/john/experimental_packages/ (made up path names there, to illustrate the point) Since the XHTML1 DTDs aren't system provided, putting them in /etc/<anything> pretty much breaks the "self contained installations" approach. It also means that the end user would need sudo access in order to do it, or have the dir pre-prepared with some kind of access setup or funky permissions. Easier to just have a flexible location for this kind of use case. :)
participants (3)
-
Daniel Veillard
-
Eric Blake
-
Justin Clift