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>
function add_html_notes() {
_src="$1"
function add_html_notes() {
_src="$1"
- 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
# 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
echo " See https://wiki.opnfv.org/documentation/tools ."
echo
sed -i "s/ _sha1_/ $git_sha1/g" "$_src"/*.rst
sed -i -e "\$a\\\n.. only:: html\n$html_notes" "$_src"/*.rst
}
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"
function add_config() {
_conf="$1"
_param="$2"
check_rst_doc $SRC_DIR
if [[ ! -d "$RELENG_DIR" ]] ; then
check_rst_doc $SRC_DIR
if [[ ! -d "$RELENG_DIR" ]] ; then
find $SRC_DIR -name $INDEX_RST -printf '%h\n' | while read dir
do
name=$(generate_name $dir)
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"
build="$BUILD_DIR/$name"
output="$OUTPUT_DIR/$name"
conf="$src/conf.py"
echo "#################${dir//?/#}"
echo
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'),]"
[[ ! -f "$conf" ]] && cp "$default_conf" "$conf"
title=$(cd $src; python -c "$get_title_script")
latex_conf="[('index', '$name.tex', \"$title\", 'OPNFV', 'manual'),]"