support ODT format creation in docs-build.sh 71/5871/1
authorRyota MIBU <r-mibu@cq.jp.nec.com>
Fri, 8 Jan 2016 09:27:04 +0000 (18:27 +0900)
committerRyota MIBU <r-mibu@cq.jp.nec.com>
Fri, 8 Jan 2016 09:27:04 +0000 (18:27 +0900)
JIRA: RELENG-16

Change-Id: Iaee8d6947306d0cf3d5e876a757816a2e7786e6f
Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
utils/docs-build.sh

index 914eaf2..55cb9f6 100755 (executable)
@@ -179,6 +179,21 @@ do
         [[ -n "$GERRIT_COMMENT" ]] && echo "$msg" >> "$GERRIT_COMMENT"
     }
 
+    # TODO: failures in ODT creation should be handled error and
+    #       cause 'exit 1' before OPNFV B release.
+    tex=$(find $build -name '*.tex' | head -1)
+    odt=$(basename "${tex%.tex}.odt")
+    if [[ -e $tex ]] && which pandoc > /dev/null ; then
+        pandoc $tex -o $output/$odt || {
+            msg="Error: ODT creation for $dir has failed."
+            echo
+            echo "$msg"
+            echo
+        }
+    else
+        echo "Warn: tex file and/or 'pandoc' are not found, skip ODT creation."
+    fi
+
     if is_top_dir "$dir" ; then
         # NOTE: Having top level document (docs/index.rst) is not recommended.
         #       It may cause conflicts with other docs (mostly with HTML