From f59a2d4f1c5655e5ec4f3ab5fe70932ac2fa94f0 Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Wed, 20 Jul 2016 22:04:43 +0900 Subject: support pre-hook in docs-build.sh Some projects need special pre steps before executing docs-build.sh . For instance, opnfvdocs needs to download other repos which will be composited. Also, apidoc creation is needed during docs build in yardstick. In order to support such cases, this patch introduces pre-hook in docs-build.sh that provides much flexibility to projects and simplifies job definition in releng. Change-Id: If9f26c490671ec0788dc48dd4fccb4513d0ca777 Signed-off-by: Ryota MIBU --- scripts/docs-build.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/docs-build.sh b/scripts/docs-build.sh index f95dd481d..afa68ec65 100755 --- a/scripts/docs-build.sh +++ b/scripts/docs-build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash # SPDX-license-identifier: Apache-2.0 ############################################################################## # Copyright (c) 2016 NEC and others. @@ -7,7 +7,6 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -export PATH=$PATH:/usr/local/bin/ DOCS_DIR=${DOCS_DIR:-docs} INDEX_RST=${INDEX_RST:-index.rst} @@ -58,7 +57,9 @@ function check_rst_doc() { echo echo -e "$_msg\n$_errs" echo - [[ -n "$GERRIT_COMMENT" ]] && echo -e "$_msg\n$_errs" >> "$GERRIT_COMMENT" + if [ -n "$GERRIT_COMMENT" ]; then + echo -e "$_msg\n$_errs" >> "$GERRIT_COMMENT" + fi } } @@ -82,7 +83,9 @@ function add_html_notes() { function prepare_src_files() { mkdir -p "$(dirname $SRC_DIR)" - [[ -e "$SRC_DIR" ]] && rm -rf "$SRC_DIR" + if [ -e "$SRC_DIR" ]; then + rm -rf "$SRC_DIR" + fi cp -r "$DOCS_DIR" "$SRC_DIR" add_html_notes "$SRC_DIR" } @@ -187,6 +190,11 @@ fi virtualenv "$VENV_DIR" source "$VENV_DIR/bin/activate" + +if [ -e "$DOCS_DIR/pre-hook.sh" ]; then + source "$DOCS_DIR/pre-hook.sh" +fi + pip install -r "$OPNFVDOCS_DIR/etc/requirements.txt" find $DOCS_DIR -name $INDEX_RST -printf '%h\n' | while read dir @@ -227,7 +235,9 @@ do echo echo "$msg" echo - [[ -n "$GERRIT_COMMENT" ]] && echo "$msg" >> "$GERRIT_COMMENT" + if [ -n "$GERRIT_COMMENT" ]; then + echo "$msg" >> "$GERRIT_COMMENT" + fi } # TODO: failures in ODT creation should be handled error and -- cgit 1.2.3-korg