You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/06/25 15:45:13 UTC

[impala] 01/20: IMPALA-7314: Doc generation should fail on error

This is an automated email from the ASF dual-hosted git repository.

tarmstrong pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/impala.git

commit c8b03a7c1ad4046acd8710740bab37f34c6e1d9c
Author: Fredy Wijaya <fw...@cloudera.com>
AuthorDate: Tue Jul 17 21:34:46 2018 -0700

    IMPALA-7314: Doc generation should fail on error
    
    This patch updates the doc generation to fail when there is an error.
    dita does not exit with non-zero exit code when there is an error. The
    patch checks for [ERROR] in the dita output and fails if it encounters
    one.
    
    Testing:
    - Manually tested by injecting failures
    
    Change-Id: Ic452aa282a3f2a761e3b04a7460e0d86bc51d721
    Reviewed-on: http://gerrit.cloudera.org:8080/10976
    Reviewed-by: Alex Rodoni <ar...@cloudera.com>
    Reviewed-by: Michael Brown <mi...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 docs/.gitignore                 |  1 +
 docs/Makefile                   |  4 ++--
 docs/{Makefile => build-doc.sh} | 26 +++++++++++++++-----------
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/docs/.gitignore b/docs/.gitignore
index b6e5611..cf8132f 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -1,2 +1,3 @@
 !Makefile
 build/
+*.log
diff --git a/docs/Makefile b/docs/Makefile
index 99a0e09..fc2f8e9 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -26,7 +26,7 @@ pdf: build/impala.pdf
 ALL_DEPS=Makefile impala.ditamap shared/*.xml images/* topics/*.xml
 
 build/html/index.html: impala_html.ditaval ${ALL_DEPS}
-	dita -i impala.ditamap -f html5 -o $(dir $@) -filter $<
+	./build-doc.sh html5 $(dir $@) $< gen-html.log
 
 build/impala.pdf: impala_pdf.ditaval ${ALL_DEPS}
-	dita -i impala.ditamap -f pdf -o $(dir $@) -filter $<
+	./build-doc.sh pdf $(dir $@) $< gen-pdf.log
diff --git a/docs/Makefile b/docs/build-doc.sh
old mode 100644
new mode 100755
similarity index 68%
copy from docs/Makefile
copy to docs/build-doc.sh
index 99a0e09..6153e1d
--- a/docs/Makefile
+++ b/docs/build-doc.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,18 +17,20 @@
 # specific language governing permissions and limitations
 # under the License.
 
-.PHONY: all html pdf
-
-all: html pdf
-
-html: build/html/index.html
+set -euo pipefail
 
-pdf: build/impala.pdf
+function usage() {
+  echo "$0 <file_format> <output_file> <filter_file> <log_file>"
+  exit 1
+}
 
-ALL_DEPS=Makefile impala.ditamap shared/*.xml images/* topics/*.xml
+[[ $# -eq 4 ]] || usage
 
-build/html/index.html: impala_html.ditaval ${ALL_DEPS}
-	dita -i impala.ditamap -f html5 -o $(dir $@) -filter $<
+FILE_FORMAT=$1
+OUTPUT_FILE=$2
+FILTER_FILE=$3
+LOG_FILE=$4
 
-build/impala.pdf: impala_pdf.ditaval ${ALL_DEPS}
-	dita -i impala.ditamap -f pdf -o $(dir $@) -filter $<
+dita -i impala.ditamap -f ${FILE_FORMAT} -o ${OUTPUT_FILE} -filter ${FILTER_FILE} 2>&1 \
+    | tee ${LOG_FILE}
+[[ -z $(grep "\[ERROR\]" ${LOG_FILE}) ]] || exit 1