[libvirt] [PATCH] build: Fix API docs generation in VPATH build

--- docs/Makefile.am | 12 ++++++++---- docs/devhelp/devhelp.xsl | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index adf74ee..c4926d4 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -88,7 +88,10 @@ EXTRA_DIST= \ sitemap.html.in \ todo.pl todo.cfg-example -MAINTAINERCLEANFILES = $(dot_html) $(apihtml) $(devhelphtml) +MAINTAINERCLEANFILES = \ + $(addprefix $(srcdir)/,$(dot_html)) \ + $(addprefix $(srcdir)/,$(apihtml)) \ + $(addprefix $(srcdir)/,$(devhelphtml)) all: web @@ -146,19 +149,20 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in -@if [ -x $(XSLTPROC) ] ; then \ echo "Rebuilding the HTML pages from the XML API" ; \ - $(XSLTPROC) --nonet $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi + $(XSLTPROC) --nonet -o $(srcdir)/ \ + $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi -@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \ > /dev/null ; then \ echo "Validating the resulting XHTML pages" ; \ SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \ - $(XMLLINT) --catalogs --nonet --valid --noout html/*.html ; \ + $(XMLLINT) --catalogs --nonet --valid --noout $(srcdir)/html/*.html ; \ else echo "missing XHTML1 DTD" ; fi ; fi $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl) -@echo Rebuilding devhelp files -@if [ -x $(XSLTPROC) ] ; then \ - $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \ + $(XSLTPROC) --nonet -o $(srcdir)/devhelp/ \ $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi python_generated_files = \ diff --git a/docs/devhelp/devhelp.xsl b/docs/devhelp/devhelp.xsl index 6600f5f..add5794 100644 --- a/docs/devhelp/devhelp.xsl +++ b/docs/devhelp/devhelp.xsl @@ -13,6 +13,13 @@ <!-- Build keys for all symbols --> <xsl:key name="symbols" match="/api/symbols/*" use="@name"/> + <xsl:template match="/"> + <xsl:document xmlns="http://www.devhelp.net/book" href="libvirt.devhelp" + method="xml" encoding="UTF-8" indent="yes"> + <xsl:apply-templates/> + </xsl:document> + </xsl:template> + <xsl:template match="/api"> <book title="{@name} Reference Manual" link="index.html" author="" name="{@name}"> <xsl:apply-templates select="files"/> -- 1.7.4.1

On Fri, Feb 18, 2011 at 12:25:03PM +0100, Jiri Denemark wrote:
--- docs/Makefile.am | 12 ++++++++---- docs/devhelp/devhelp.xsl | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am index adf74ee..c4926d4 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -88,7 +88,10 @@ EXTRA_DIST= \ sitemap.html.in \ todo.pl todo.cfg-example
-MAINTAINERCLEANFILES = $(dot_html) $(apihtml) $(devhelphtml) +MAINTAINERCLEANFILES = \ + $(addprefix $(srcdir)/,$(dot_html)) \ + $(addprefix $(srcdir)/,$(apihtml)) \ + $(addprefix $(srcdir)/,$(devhelphtml))
all: web
@@ -146,19 +149,20 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in -@if [ -x $(XSLTPROC) ] ; then \ echo "Rebuilding the HTML pages from the XML API" ; \ - $(XSLTPROC) --nonet $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi + $(XSLTPROC) --nonet -o $(srcdir)/ \ + $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi -@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \ > /dev/null ; then \ echo "Validating the resulting XHTML pages" ; \ SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \ - $(XMLLINT) --catalogs --nonet --valid --noout html/*.html ; \ + $(XMLLINT) --catalogs --nonet --valid --noout $(srcdir)/html/*.html ; \ else echo "missing XHTML1 DTD" ; fi ; fi
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl) -@echo Rebuilding devhelp files -@if [ -x $(XSLTPROC) ] ; then \ - $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \ + $(XSLTPROC) --nonet -o $(srcdir)/devhelp/ \ $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi
python_generated_files = \
Up to here it's rather trivial.
diff --git a/docs/devhelp/devhelp.xsl b/docs/devhelp/devhelp.xsl index 6600f5f..add5794 100644 --- a/docs/devhelp/devhelp.xsl +++ b/docs/devhelp/devhelp.xsl @@ -13,6 +13,13 @@ <!-- Build keys for all symbols --> <xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
+ <xsl:template match="/"> + <xsl:document xmlns="http://www.devhelp.net/book" href="libvirt.devhelp" + method="xml" encoding="UTF-8" indent="yes"> + <xsl:apply-templates/> + </xsl:document> + </xsl:template> + <xsl:template match="/api"> <book title="{@name} Reference Manual" link="index.html" author="" name="{@name}"> <xsl:apply-templates select="files"/>
But that chunk is far from clear, why are you doing this ? 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 Fri, Feb 18, 2011 at 20:42:10 +0800, Daniel Veillard wrote:
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl) -@echo Rebuilding devhelp files -@if [ -x $(XSLTPROC) ] ; then \ - $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \ + $(XSLTPROC) --nonet -o $(srcdir)/devhelp/ \ $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi
diff --git a/docs/devhelp/devhelp.xsl b/docs/devhelp/devhelp.xsl index 6600f5f..add5794 100644 --- a/docs/devhelp/devhelp.xsl +++ b/docs/devhelp/devhelp.xsl @@ -13,6 +13,13 @@ <!-- Build keys for all symbols --> <xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
+ <xsl:template match="/"> + <xsl:document xmlns="http://www.devhelp.net/book" href="libvirt.devhelp" + method="xml" encoding="UTF-8" indent="yes"> + <xsl:apply-templates/> + </xsl:document> + </xsl:template> + <xsl:template match="/api"> <book title="{@name} Reference Manual" link="index.html" author="" name="{@name}"> <xsl:apply-templates select="files"/>
But that chunk is far from clear, why are you doing this ?
Ah, the reasoning was in a different email, I should have copied at least part of it into the commit message for this patch: xsltproc --nonet -o ./ ./newapi.xsl ./libvirt-api.xml works (outputs 4 *.html files into ./), while: xsltproc --nonet -o ./devhelp/ ./devhelp/devhelp.xsl ./libvirt-api.xml outputs 4 *.html files into ./devhelp but then tries to write to ./devhelp/ as a file (hence the I/O error) rather than writing output to the fifth file devhelp/libvirt.devhelp. That's because XSLT allows for two ways of generating the output of transformation. Either implicit, which xsltproc prints to stdout and can be redirected to a file using -o file. Or explicit, which means the stylesheet contains <xsl:document> element(s) which specifies where the output should be saved. This can be used for generating more files by a single run of xsltproc and -o directory/ can change the directory where the output files will be stored. And since this is cool, why not combine these two approaches in a single file? And that's exactly what happened in devhelp.xsl. It generates 4 html files explicitly and one xml file implicitly. So -o can't ever work for this. Jirka

On 02/18/2011 06:31 AM, Jiri Denemark wrote:
+++ b/docs/devhelp/devhelp.xsl @@ -13,6 +13,13 @@ <!-- Build keys for all symbols --> <xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
+ <xsl:template match="/"> + <xsl:document xmlns="http://www.devhelp.net/book" href="libvirt.devhelp" + method="xml" encoding="UTF-8" indent="yes"> + <xsl:apply-templates/> + </xsl:document> + </xsl:template> + <xsl:template match="/api"> <book title="{@name} Reference Manual" link="index.html" author="" name="{@name}"> <xsl:apply-templates select="files"/>
But that chunk is far from clear, why are you doing this ?
Ah, the reasoning was in a different email, I should have copied at least part of it into the commit message for this patch:
ACK! (but only with the commit message expanded to include the rationale). With this patch applied, and just a bit more effort, I was able to run autobuild.sh in a VPATH situation from a fresh clone - patch coming up soon... -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Fri, Feb 18, 2011 at 09:54:39 -0700, Eric Blake wrote:
On 02/18/2011 06:31 AM, Jiri Denemark wrote:
+++ b/docs/devhelp/devhelp.xsl @@ -13,6 +13,13 @@ <!-- Build keys for all symbols --> <xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
+ <xsl:template match="/"> + <xsl:document xmlns="http://www.devhelp.net/book" href="libvirt.devhelp" + method="xml" encoding="UTF-8" indent="yes"> + <xsl:apply-templates/> + </xsl:document> + </xsl:template> + <xsl:template match="/api"> <book title="{@name} Reference Manual" link="index.html" author="" name="{@name}"> <xsl:apply-templates select="files"/>
But that chunk is far from clear, why are you doing this ?
Ah, the reasoning was in a different email, I should have copied at least part of it into the commit message for this patch:
ACK! (but only with the commit message expanded to include the rationale).
Fixed and pushed. Thanks Jirka
participants (3)
-
Daniel Veillard
-
Eric Blake
-
Jiri Denemark