diff options
author | Ryota MIBU <r-mibu@cq.jp.nec.com> | 2015-12-22 00:51:04 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-12-22 00:51:04 +0000 |
commit | 65a20fd8c00a8119f23e6bbace802ee430e6129f (patch) | |
tree | 7966d08f9c133f954ef7cb7cb90192d1954488f1 /utils | |
parent | b0eef185248b34d2f2c0ff035641c5ae212548cc (diff) | |
parent | e83087994e3e1375668361f754640422c059243e (diff) |
Merge "fix doc-build.sh to support referring to other dirs"
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/docs-build.sh | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/utils/docs-build.sh b/utils/docs-build.sh index 5f9eeee69..99c5aea86 100755 --- a/utils/docs-build.sh +++ b/utils/docs-build.sh @@ -60,12 +60,11 @@ function check_rst_doc() { function add_html_notes() { _src="$1" - _dir="$2" - if grep -q -e ' _sha1_' "$_src"/*.rst ; then + if grep -e ' _sha1_' "$_src"/*.rst ; then # TODO: remove this, once old templates were removed from all repos. echo - echo "Warn: '_sha1_' was found in $_dir , use the latest document template." + echo "Warn: '_sha1_' was found, use the latest document template." echo " See https://wiki.opnfv.org/documentation/tools ." echo sed -i "s/ _sha1_/ $git_sha1/g" "$_src"/*.rst @@ -73,6 +72,13 @@ function add_html_notes() { sed -i -e "\$a\\\n.. only:: html\n$html_notes" "$_src"/*.rst } +function prepare_src_files() { + mkdir -p "$BUILD_DIR" + [[ -e "$BUILD_DIR/src" ]] && rm -rf "$BUILD_DIR/src" + cp -r "$SRC_DIR" "$BUILD_DIR/src" + add_html_notes "$BUILD_DIR/src" +} + function add_config() { _conf="$1" _param="$2" @@ -113,6 +119,7 @@ function generate_name() { echo "${_name////_}" } + check_rst_doc $SRC_DIR if [[ ! -d "$RELENG_DIR" ]] ; then @@ -120,10 +127,12 @@ if [[ ! -d "$RELENG_DIR" ]] ; then exit 1 fi +prepare_src_files + find $SRC_DIR -name $INDEX_RST -printf '%h\n' | while read dir do name=$(generate_name $dir) - src="$BUILD_DIR/src/$name" + src="$BUILD_DIR/src${dir#$SRC_DIR}" build="$BUILD_DIR/$name" output="$OUTPUT_DIR/$name" conf="$src/conf.py" @@ -134,12 +143,6 @@ do echo "#################${dir//?/#}" echo - mkdir -p "$BUILD_DIR/src" - [[ -e "$src" ]] && rm -rf "$src" - cp -r "$dir" "$src" - - add_html_notes "$src" "$dir" - [[ ! -f "$conf" ]] && cp "$default_conf" "$conf" title=$(cd $src; python -c "$get_title_script") latex_conf="[('index', '$name.tex', \"$title\", 'OPNFV', 'manual'),]" |