[RFC PATCH] build: detect doc build errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes more cases of xmllint not detecting errors.

HOWEVER - xsltproc mistakenly exits with $? of 0 even when
encountering problems.  It's probably better to run a separate
xmllint before xsltproc to ensure the input file is well-formed
xml (not just that the output file was well-formed html), but
I'm not sure how to do that.  We could also get away with
checking if xsltproc stderr is empty.

* docs/Makefile.am (maintainer-clean-local): Remove generated docs
in VPATH build.
(html/index.html): Exit on formatting problems.
(rebuild): Run full doc build on request.
---

Since we already gate the conditions on whether the tools exist,
we should not ever fail, so we don't want the - prefix.

One of the two xmllint invocations forced 'exit 1' on validation
failure; make the other do likewise.

'make -C docs rebuild' can help check for errors.

 docs/Makefile.am |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/docs/Makefile.am b/docs/Makefile.am
index db4bc59..8ea9eb8 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -147,21 +147,22 @@ 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 \
+	@if [ -x $(XSLTPROC) ] ; then \
 	  echo "Rebuilding the HTML pages from the XML API" ; \
 	  $(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 \
+	@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 $(srcdir)/html/*.html ; \
+	  $(XMLLINT) --catalogs --nonet --valid --noout $(srcdir)/html/*.html \
+	    || { rm $(srcdir)/$@ && exit 1; }; \
 	  else echo "missing XHTML1 DTD" ; fi ; fi

 $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
 	-@echo Rebuilding devhelp files
-	-@if [ -x $(XSLTPROC) ] ; then \
+	@if [ -x $(XSLTPROC) ] ; then \
 	  $(XSLTPROC) --nonet -o $(srcdir)/devhelp/ \
 	  $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi

@@ -183,9 +184,11 @@ clean-local:
 	rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html

 maintainer-clean-local: clean-local
-	rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml todo.html.in
+	rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml \
+	  todo.html.in $(srcdir)/*.html $(srcdir)/devhelp/*.html \
+	  $(srcdir)/html/*.html $(srcdir)/internals/*.html

-rebuild: api all
+rebuild: maintainer-clean-local api all

 install-data-local:
 	$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
-- 
1.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]