summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2015-12-16 22:30:44 +0900
committerRyota MIBU <r-mibu@cq.jp.nec.com>2015-12-17 23:31:31 +0900
commite83087994e3e1375668361f754640422c059243e (patch)
treeccce565e63261b2a429457cb1094bbd939597bc2
parent24032643293d5e92d095ea39957f8fd0aff29290 (diff)
fix doc-build.sh to support referring to other dirs
In [1], we found that current doc-build.sh cannot create document when the main index.rst referring to rst file in another folder. The reason is current script only copies target src folder under the working directory. This patch fix this bug by making doc-build.sh to copy all src files in the original directory structure. Then, all file links (import) can work properly. Error message for '_sha1_' is modified to drop directory info, but developer can find a bad file path from grep output. [1] https://gerrit.opnfv.org/gerrit/#/c/4353 Change-Id: I1d840b8a887306539f97321570f289ac25055a88 Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
-rwxr-xr-xutils/docs-build.sh23
1 files changed, 13 insertions, 10 deletions
diff --git a/utils/docs-build.sh b/utils/docs-build.sh
index fc607fa15..56793f0e3 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'),]"