[Libreoffice-commits] help.git: CustomTarget_html.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 22 08:25:13 UTC 2019


 CustomTarget_html.mk |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit c3509fb7e6675a38560c7e2764b21861d1e23362
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Feb 22 09:23:17 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Feb 22 09:24:48 2019 +0100

    Propagate xsltproc failure
    
    Change-Id: I26516bb718b678718822ef8621bbfb868016d626
    Reviewed-on: https://gerrit.libreoffice.org/68192
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/CustomTarget_html.mk b/CustomTarget_html.mk
index b3c9b4e69..c9ef46cae 100644
--- a/CustomTarget_html.mk
+++ b/CustomTarget_html.mk
@@ -28,6 +28,9 @@ $(eval $(call gb_CustomTarget_register_targets,helpcontent2/help3xsl,\
 	) \
 ))
 
+# In the below recipe, the file $@.good is used to communicate failure of xsltproc in the pipeline
+# (similar to Bash's `set -o pipefail`; the final `rm $@.good` will fail, and fail the whole
+# command, if the xsltproc invocation failed):
 $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/hid2file.js : \
 		$(SRCDIR)/helpcontent2/help3xsl/generate_hid2file.xsl \
 		$(call gb_ExternalExecutable_get_dependencies,xsltproc) \
@@ -40,8 +43,10 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/hid2file.js : \
 			&& RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,$(foreach module,$(html_TEXT_MODULES),$(addprefix $(SRCDIR)/,$(gb_AllLangHelp_$(module)_HELPFILES)))) \
 			&& <"$$RESPONSEFILE" $(if $(filter WNT,$(OS)),tr -d '\r' | env -i PATH="$$PATH") xargs -n 1 printf '%s\n' \
 			| while read xhp; do \
-				$(call gb_ExternalExecutable_get_command,xsltproc) $< $$xhp \
+				rm -f $@.good && \
+				{ $(call gb_ExternalExecutable_get_command,xsltproc) $< $$xhp && touch $@.good; } \
 				| $(gb_AWK) 'NF' \
+				&& rm $@.good \
 			; done \
 			&& rm "$$RESPONSEFILE" \
 			&& echo '};' \
@@ -193,6 +198,9 @@ endef
 
 $(eval $(foreach module,$(html_BMARK_MODULES),$(call html_gen_bookmarks_deps,$(subst :, ,$(module)))))
 
+# In the below recipe, the file $@.good is used to communicate failure of xsltproc in the pipeline
+# (similar to Bash's `set -o pipefail`; the final `rm $@.good` will fail, and fail the whole
+# command, if any xsltproc invocation failed):
 $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/bookmarks.part : \
 		$(SRCDIR)/helpcontent2/help3xsl/get_bookmark.xsl \
 		$(call gb_ExternalExecutable_get_dependencies,xsltproc)
@@ -201,7 +209,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/bookmarks.part : \
 		RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,$(addprefix $(if $(filter en-US,$(HELP_LANG)),$(SRCDIR),$(call gb_HelpTranslatePartTarget_get_workdir,$(HELP_LANG)))/,$(gb_AllLangHelp_$(APPDIR)_BOOKMARK_HELPFILES))) \
 		&& ( \
 			<"$$RESPONSEFILE" $(if $(filter WNT,$(OS)),tr -d '\r' | env -i PATH="$$PATH") xargs -n 1 printf '%s\n' \
-			| while read xhp; do \
+			| { rm -f $@.good && while read xhp; do \
 				$(call gb_ExternalExecutable_get_command,xsltproc) \
 					--stringparam app $(APP) \
 					--stringparam Language $(HELP_LANG) \
@@ -210,9 +218,10 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/bookmarks.part : \
 					--stringparam productversion "$(PRODUCTVERSION)" \
 					$(SRCDIR)/helpcontent2/help3xsl/get_bookmark.xsl \
 					$$xhp \
-			; done \
+			; done && touch $@.good; } \
 			| sort -k3b -t\> -s \
 			| awk 'NF' \
+			&& rm $@.good \
 		) > $@ \
 		&& rm "$$RESPONSEFILE" \
 	)	


More information about the Libreoffice-commits mailing list