Reviewers: dak, Graham Percival, Julien Rioux,
Message:
Slightly complicated (for me, anyway) but please review and ask
questions if it's not clear what I'm doing here.
Description:
This uses a shell script that I've written to direct the output from a
command to a logfile, and to issue a line identifying the logfile if the
command fails. I've updated the calls (all of them, I believe) to
makeinfo and texi2html to use this script. The result is about 3400
fewer lines output from make doc, and lots of lovely logfiles to check
for errors - it makes debugging docs a lot easier. It's slightly
non-trivial to test, since neither makeinfo or texi2html stops on
errored input by default. If you force it to do so (see below) sample
output is:
/home/phil/lilypond-git/scripts/build/CheckAndRun.sh "DEPTH=../../..
AJAX_SEARCH= TOP_SRC_DIR=/home/phil/lilypond-git PERL_UNICODE=SD
texi2html --error-limit=0
--I=/home/phil/lilypond-git/input/regression/lilypond-book --I=./out-www
-I /home/phil/lilypond-git/Documentation
--I=/media/IntelSSD/lilypond/lilypond-git/build/./out-www/xref-maps
--init-file=/home/phil/lilypond-git/Documentation/lilypond-texi2html.init
--output=out-www/collated-files.html out-www/collated-files.texi"
"collated-files.texilog.log"
Please check the logfile collated-files.texilog.log for errors
make[4]: *** [out-www/collated-files.html] Error 2
make[4]: Leaving directory
`/media/IntelSSD/lilypond/lilypond-git/build/input/regression/lilypond-book'
make[3]: *** [WWW-2] Error 2
make[3]: Leaving directory
`/media/IntelSSD/lilypond/lilypond-git/build/input/regression'
make[2]: *** [WWW-2] Error 2
make[2]: Leaving directory
`/media/IntelSSD/lilypond/lilypond-git/build/input'
make[1]: *** [WWW-2] Error 2
make[1]: Leaving directory `/media/IntelSSD/lilypond/lilypond-git/build'
make: *** [doc] Error 2
Command exited with non-zero status 2
The logfile that's fingered contains this:
*** Duplicate node found: Top (in out-www/papersize-docs.texi l. 8)
Max error number exceeded
To show this in action, you would need to edit texinfo-vars.make as
below.
-TEXI2HTML_FLAGS += $(TEXI2HTML_INCLUDES) $(TEXI2HTML_INIT)
$(TEXI2HTML_LANG)
+TEXI2HTML_FLAGS += --error-limit=0 $(TEXI2HTML_INCLUDES)
$(TEXI2HTML_INIT) $(TEXI2HTML_LANG)
Please review this at http://codereview.appspot.com/5645046/
Affected files:
M Documentation/GNUmakefile
M make/doc-i18n-root-rules.make
A scripts/build/CheckAndRun.sh
M stepmake/stepmake/texinfo-rules.make
Index: Documentation/GNUmakefile
diff --git a/Documentation/GNUmakefile b/Documentation/GNUmakefile
index
22da2d8fa8d73a3746c11f5d9d64f641fb45fda1..a93926a1553f5cdb87f89e005e9d596af2f781af
100644
--- a/Documentation/GNUmakefile
+++ b/Documentation/GNUmakefile
@@ -195,7 +195,7 @@ endif
### Rules
$(outdir)/lilypond-%.info: $(outdir)/%.texi
$(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi
$(outdir)/weblinks.itexi
- $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) --output=$@ $<" "$*.makeinfo.log"
txt-to-html: $(OUT_TXT_FILES) $(OUT_TXT_FILES:%.txt=%.html)
@@ -231,11 +231,11 @@ endif
# Ugh, using '%' twice not possible
$(outdir)/notation/notation.xml: $(outdir)/notation.texi
mkdir -p $(dir $@)
- $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) --output=$(dir $@) --docbook $<" "$*.makeinfo.log"
$(outdir)/internals/internals.xml: $(outdir)/internals.texi
mkdir -p $(dir $@)
- $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) --output=$(dir $@) --docbook $<" "$*.makeinfo.log"
$(outdir)/learning.texi $(outdir)/notation.texi: $(OUT_PDF_IMAGES)
Index: make/doc-i18n-root-rules.make
diff --git a/make/doc-i18n-root-rules.make b/make/doc-i18n-root-rules.make
index
3cdd664471ffc6541a413c2c4c019950c3d77a9f..b19364c11d3868c3864aa1619e04465ceef4f230
100644
--- a/make/doc-i18n-root-rules.make
+++ b/make/doc-i18n-root-rules.make
@@ -7,14 +7,14 @@ $(outdir)/web.texi: $(outdir)/weblinks.itexi
$(top-build-dir)/Documentation/$(outdir)/%/index.$(ISOLANG).html:
$(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map
$(TRANSLATION_LILY_IMAGES)
mkdir -p $(dir $@)
mkdir -p $(outdir)/$*
- DEPTH=$(depth)/../ $(TEXI2HTML) $(TEXI2HTML_SPLIT) $(TEXI2HTML_FLAGS)
--output=$(outdir)/$* $< >$*.splittexi.log 2>&1
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth)/../
$(TEXI2HTML) $(TEXI2HTML_SPLIT) $(TEXI2HTML_FLAGS) --output=$(outdir)/$*
$<" "$*.splittexi.log"
find $(outdir)/$* -name '*.html' | xargs grep -L 'UNTRANSLATED NODE:
IGNORE ME' | sed 's!$(outdir)/!!g' | xargs $(buildscript-dir)/mass-link
--prepend-suffix .$(ISOLANG) hard $(outdir)
$(top-build-dir)/Documentation/$(outdir)
$(top-build-dir)/Documentation/$(outdir)/%-big-page.$(ISOLANG).html:
$(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map
$(TRANSLATION_LILY_IMAGES)
- DEPTH=$(depth) $(TEXI2HTML) -D bigpage $(TEXI2HTML_FLAGS) --output=$@ $<
$*.bigtexi.log 2>&1
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth) $(TEXI2HTML)
-D bigpage $(TEXI2HTML_FLAGS) --output=$@ $<" "$*.bigtexi.log"
$(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).html:
$(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map
$(outdir)/version.itexi $(outdir)/weblinks.itexi
- DEPTH=$(depth) $(TEXI2HTML) $(TEXI2HTML_FLAGS) --output=$@ $< >$*.texilog
2>&1
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth) $(TEXI2HTML)
$(TEXI2HTML_FLAGS) --output=$@ $<" "$*.texilog.log"
$(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).pdf: $(outdir)/%.texi
cd $(outdir) && \
@@ -45,11 +45,11 @@ $(TRANSLATION_LILY_IMAGES): $(MASTER_TEXI_FILES)
touch $@
$(outdir)/lilypond-%.info: $(outdir)/%.texi
$(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi
$(outdir)/weblinks.itexi
- $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) --output=$@ $<" "$*.makeinfo.log"
$(outdir)/index.$(ISOLANG).html: TEXI2HTML_INIT = $(WEB_TEXI2HTML_INIT)
$(outdir)/index.$(ISOLANG).html: TEXI2HTML_SPLIT = $(WEB_TEXI2HTML_SPLIT)
$(outdir)/index.$(ISOLANG).html:
- DEPTH=$(depth) $(TEXI2HTML) $(TEXI2HTML_FLAGS) $(TEXI2HTML_SPLIT)
--output=$(outdir)/ web.texi
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth) $(TEXI2HTML)
$(TEXI2HTML_FLAGS) $(TEXI2HTML_SPLIT) --output=$(outdir)/
web.texi" "$*.splittexi.log"
find $(outdir)/ -name '*.html' | xargs grep -L 'UNTRANSLATED NODE: IGNORE
ME' | sed 's!$(outdir)/!!g' | xargs $(buildscript-dir)/mass-link
--prepend-suffix .$(ISOLANG) hard $(outdir)
$(top-build-dir)/Documentation/$(outdir)
Index: scripts/build/CheckAndRun.sh
diff --git a/scripts/build/CheckAndRun.sh b/scripts/build/CheckAndRun.sh
new file mode 100755
index
0000000000000000000000000000000000000000..fb3858fcc2baf547741f545bc54ebc22fd5c5b9d
--- /dev/null
+++ b/scripts/build/CheckAndRun.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# CheckAndRun.sh. Takes 2 parameters - the command to be run and
+# the logfile to send output to. If there is an error, the error
+# value is returned (when used from make will stop make) and a
+# message showing the logfile to inspect is displayed.
+
+exec 6>&1 # Link file descriptor #6 with stdout (descriptor 1).
+ # Saves stdout.
+exec > $2 # Stdout replaced with parameter 2 - the logfile
+eval $1 2>&1 # Run parameter 1 - the command
+ # The 2>&1 redirects stderr to the same descriptor as stdin
+RetVal=$? # Save the return code in RetVal
+exec 1>&6 6>&- # Restore stdout and close file descriptor #6
+if [ $RetVal -ne 0 ]; then
+ echo
+ echo "Please check the logfile" $2 "for errors"
+ echo
+fi
+exit $RetVal # Exit shell, using same return val as the command
Index: stepmake/stepmake/texinfo-rules.make
diff --git a/stepmake/stepmake/texinfo-rules.make
b/stepmake/stepmake/texinfo-rules.make
index
a3133d6aeae0e10522058c5accab51c641650f38..af48bf5293b21a772ec726dd1f2ef130259391ae
100644
--- a/stepmake/stepmake/texinfo-rules.make
+++ b/stepmake/stepmake/texinfo-rules.make
@@ -34,34 +34,35 @@ $(outdir)/%.itexi: %.itexi
$(outdir)/%.info: $(outdir)/%.texi
$(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi
$(outdir)/weblinks.itexi
ifeq ($(WEB_VERSION),yes)
- $(MAKEINFO) -I$(src-dir) -I$(outdir) -D web_version --output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) -D web_version --output=$@ $<" "$*.makeinfo.log"
else
- $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) --output=$@ $<" "$*.makeinfo.log"
endif
$(outdir)/%-big-page.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map
$(outdir)/version.itexi $(outdir)/weblinks.itexi
ifeq ($(WEB_VERSION),yes)
- DEPTH=$(depth) AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_FLAGS)
-D bigpage -D web_version --output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth)
AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_FLAGS) -D bigpage -D
web_version --output=$@ $<" "$*.bigtexi.log"
else
- DEPTH=$(depth) AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_FLAGS)
-D bigpage --output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth)
AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_FLAGS) -D bigpage
--output=$@ $<" "$*.bigtexi.log"
endif
$(outdir)/%.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map
$(outdir)/version.itexi $(outdir)/weblinks.itexi
- DEPTH=$(depth) AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_FLAGS)
--output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth)
AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_FLAGS) --output=$@
$<" "$*.texilog.log"
+
$(outdir)/%/index.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map
$(outdir)/version.itexi $(outdir)/weblinks.itexi $(outdir)/%.html.omf
mkdir -p $(dir $@)
ifeq ($(WEB_VERSION),yes)
- DEPTH=$(depth)/../ AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML)
$(TEXI2HTML_SPLIT) $(TEXI2HTML_FLAGS) -D web_version --output=$(dir $@) $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth)/../
AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_SPLIT)
$(TEXI2HTML_FLAGS) -D web_version --output=$(dir $@) $<" "$*.splittexi.log"
else
- DEPTH=$(depth)/../ AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML)
$(TEXI2HTML_SPLIT) $(TEXI2HTML_FLAGS) --output=$(dir $@) $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "DEPTH=$(depth)/../
AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_SPLIT)
$(TEXI2HTML_FLAGS) --output=$(dir $@) $<" "$*.splittexi.log"
endif
$(XREF_MAPS_DIR)/%.xref-map: $(outdir)/%.texi
$(buildscript-dir)/extract_texi_filenames $(XREF_MAP_FLAGS) -o
$(XREF_MAPS_DIR) $<
$(outdir)/%.info: %.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep
$(outdir)/version.itexi $(outdir)/weblinks.itexi
- $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) --output=$@ $<" "$*.makeinfo.log"
$(outdir)/%.pdf: $(outdir)/%.texi $(outdir)/version.itexi
$(outdir)/%.pdf.omf $(outdir)/weblinks.itexi
ifeq ($(WEB_VERSION),yes)
@@ -71,7 +72,7 @@ else
endif
$(outdir)/%.txt: $(outdir)/%.texi $(outdir)/version.itexi
$(outdir)/weblinks.itexi
- $(MAKEINFO) -I$(src-dir) -I$(outdir) --no-split --no-headers --output $@
$<
+ $(top-src-dir)/scripts/build/CheckAndRun.sh "$(MAKEINFO) -I$(src-dir)
-I$(outdir) --no-split --no-headers --output $@ $<" "$*.makeinfo.log"
$(outdir)/%.html.omf: %.texi
$(call GENERATE_OMF,html)
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel