[PATCH] doc: Create a script to filter xmlto output

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 4 21:38:03 PST 2015


On Sun, Jan 04, 2015 at 07:17:10PM -0800, Keith Packard wrote:
> This reduces the build log spam while still preserving the xmlto
> status to catch build failures correctly.
> 
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  devbook.am       | 10 ++++++----
>  doc/filter-xmlto | 17 +++++++++++++++++
>  2 files changed, 23 insertions(+), 4 deletions(-)
>  create mode 100755 doc/filter-xmlto
> 
> diff --git a/devbook.am b/devbook.am
> index 400b2ca..8b6b7ce 100644
> --- a/devbook.am
> +++ b/devbook.am
> @@ -20,6 +20,8 @@ noinst_DATA =
>  # DocBook/XML file with chapters, appendix and images it includes
>  dist_noinst_DATA = $(docbook) $(chapters)
>  
> +FILTER_XMLTO=sh $(top_srcdir)/doc/filter-xmlto $(XMLTO)
> +

not 100% sure but should this use $(SHELL)?
also, you probably need to add this to EXTRA_DIST

other than that a very handwavy Acked-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter

>  if HAVE_STYLESHEETS
>  
>  XMLTO_HTML_FLAGS = 					\
> @@ -29,12 +31,12 @@ XMLTO_HTML_FLAGS = 					\
>  
>  noinst_DATA += $(docbook:.xml=.html)
>  %.html: %.xml  $(chapters)
> -	$(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) xhtml-nochunks $<
> +	$(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_HTML_FLAGS) xhtml-nochunks $<
>  
>  if HAVE_XMLTO_TEXT
>  noinst_DATA += $(docbook:.xml=.txt)
>  %.txt: %.xml $(chapters)
> -	$(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) txt $<
> +	$(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_HTML_FLAGS) txt $<
>  endif HAVE_XMLTO_TEXT
>  
>  if HAVE_FOP
> @@ -46,9 +48,9 @@ XMLTO_FO_FLAGS = 					\
>  
>  noinst_DATA += $(docbook:.xml=.pdf) $(docbook:.xml=.ps)
>  %.pdf: %.xml $(chapters)
> -	$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $<
> +	$(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $<
>  %.ps: %.xml $(chapters)
> -	$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $<
> +	$(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $<
>  endif HAVE_FOP
>  endif HAVE_STYLESHEETS
>  
> diff --git a/doc/filter-xmlto b/doc/filter-xmlto
> new file mode 100755
> index 0000000..cc68f4d
> --- /dev/null
> +++ b/doc/filter-xmlto
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +#
> +# Run the xmlto command, filtering its output to
> +# reduce the amount of useless warnings in the build log.
> +#
> +# Exit with the status of the xmlto process, not the status of the
> +# output filtering commands
> +#
> +# This is a bit twisty, but avoids any temp files by using pipes for
> +# everything. It routes the command output through file
> +# descriptor 4 while sending the (numeric) exit status through
> +# standard output.
> +#
> +(((("$@" 2>&1; echo $? >&3) |
> +      grep -v overflows |
> +      grep -v Rendered >&4) 3>&1) |
> +     (read status; exit $status)) 4>&1
> -- 
> 2.1.4
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list