summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2015-12-17 13:58:40 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-12-17 13:58:40 +0000
commit24032643293d5e92d095ea39957f8fd0aff29290 (patch)
tree457b96e29a8c31408607ceb1058faa349a6ad656
parent1742106811e2fd38a2ba481d0bff3db5b4b47967 (diff)
parent419d461e2ce89a496f63cfa349a46849041684ba (diff)
Merge "update doc-build.sh to allow multiple depth of dir"
-rwxr-xr-xutils/docs-build.sh35
1 files changed, 34 insertions, 1 deletions
diff --git a/utils/docs-build.sh b/utils/docs-build.sh
index 5ac8b2be6..fc607fa15 100755
--- a/utils/docs-build.sh
+++ b/utils/docs-build.sh
@@ -84,6 +84,34 @@ function add_config() {
fi
}
+function is_top_dir() {
+ [[ "$1" == "$SRC_DIR" ]]
+}
+
+function generate_name_for_top_dir() {
+ for suffix in '' '.top' '.all' '.master' '_' '__' '___'
+ do
+ _name="$(basename $SRC_DIR)$suffix"
+ [[ -e "$SRC_DIR/$_name" ]] && continue
+ echo "$_name"
+ return
+ done
+
+ echo "Error: cannot find name for top directory [$SRC_DIR]"
+ exit 1
+}
+
+function generate_name() {
+ _dir=$1
+
+ if is_top_dir "$_dir" ; then
+ _name=$(generate_name_for_top_dir $SRC_DIR)
+ else
+ _name="${_dir#$SRC_DIR/}"
+ fi
+ # Replace '/' by '_'
+ echo "${_name////_}"
+}
check_rst_doc $SRC_DIR
@@ -94,7 +122,7 @@ fi
find $SRC_DIR -name $INDEX_RST -printf '%h\n' | while read dir
do
- name="${dir##*/}"
+ name=$(generate_name $dir)
src="$BUILD_DIR/src/$name"
build="$BUILD_DIR/$name"
output="$OUTPUT_DIR/$name"
@@ -143,4 +171,9 @@ do
[[ -n "$GERRIT_COMMENT" ]] && echo "$msg" >> "$GERRIT_COMMENT"
}
+ if is_top_dir "$dir" ; then
+ mv "$output"/* "$OUTPUT_DIR"/
+ rm -rf "$output"
+ fi
+
done