From 80c1b9a92d02a2a565876092d0495dd79d3ed2c6 Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Tue, 18 Oct 2016 11:49:58 +0800 Subject: Exit script with error count related JIRA: DOCS-71 Change-Id: I08501e6193dc555ebbb7b4b69af65e50ef4be5b7 Signed-off-by: Yujun Zhang --- scripts/docs-build.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/docs-build.sh b/scripts/docs-build.sh index 0483fce05..c912bdf8c 100755 --- a/scripts/docs-build.sh +++ b/scripts/docs-build.sh @@ -8,6 +8,8 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +set +e + DOCS_DIR=${DOCS_DIR:-docs} INDEX_RST=${INDEX_RST:-index.rst} BUILD_DIR=${BUILD_DIR:-docs_build} @@ -25,6 +27,12 @@ html_notes=" Revision: $rev_full\n Build date: $(date -u +'%Y-%m-%d')" opnfv_logo="$OPNFVDOCS_DIR/etc/opnfv-logo.png" copyright="$(date +%Y), OPNFV." copyrightlong="$(date +%Y), OPNFV. Licenced under CC BY 4.0." +error_count=0 + +function set_error() { + # TODO(yujunz) log detail errors + error_count=$((error_count + 1)) +} if [ "$(uname)" == "Darwin" ]; then # Override system $SED/$FIND with gnu $SED and gnu $FIND @@ -151,8 +159,8 @@ function generate_name_for_top_dir() { return done - echo "Error: cannot $FIND name for top directory [$DOCS_DIR]" - exit 1 + echo "Error: cannot find name for top directory [$DOCS_DIR]" + set_error } function generate_name() { @@ -171,12 +179,12 @@ function generate_name() { if [[ ! -d "$OPNFVDOCS_DIR" ]] ; then echo "Error: $OPNFVDOCS_DIR dir not found." echo "See http://artifacts.opnfv.org/opnfvdocs/docs/how-to-use-docs ." - exit 1 + set_error fi if ! which virtualenv > /dev/null ; then echo "Error: 'virtualenv' not found. Exec 'sudo pip install virtualenv' first." - exit 1 + set_error fi # workaround for doc8 error in python2.6 @@ -249,3 +257,5 @@ do done deactivate + +exit(error_count) -- cgit 1.2.3-korg