From de062557cc6a8b0ab17c565fa3fae36f3b4f9d33 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 6 Oct 2015 18:41:13 +0200 Subject: [PATCH] Update doc-tools-build-rst Import change I6c275518b9e55ab3b6bcea52894ea851924bee94 from openstack-manuals: Add linkcheck for RST. Change-Id: I1774ddf76d3930318dd0f59e9f938065eb9f07a4 --- bin/doc-tools-build-rst | 43 +++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/bin/doc-tools-build-rst b/bin/doc-tools-build-rst index 10b26afc..488b123c 100755 --- a/bin/doc-tools-build-rst +++ b/bin/doc-tools-build-rst @@ -21,6 +21,7 @@ if [ -z "$DIRECTORY" ] ; then echo "--tag TAG: Use given tag for building" echo "--target TARGET: Copy files to publish-docs/$TARGET" echo "--build BUILD: Name of build directory" + echo "--linkcheck: Check validity of links instead of building" exit 1 fi @@ -29,10 +30,18 @@ TARGET="" TAG="" TAG_OPT="" BUILD="" +LINKCHECK="" -while [[ $# > 1 ]] ; do +while [[ $# > 0 ]] ; do option="$1" case $option in + --build) + BUILD="$2" + shift + ;; + --linkcheck) + LINKCHECK=1 + ;; --glossary) GLOSSARY=1 ;; @@ -45,10 +54,6 @@ while [[ $# > 1 ]] ; do TARGET="$2" shift ;; - --build) - BUILD="$2" - shift - ;; esac shift done @@ -70,17 +75,25 @@ else fi if [ -z "$TAG" ] ; then - echo "Building $DIRECTORY" + echo "Checking $DIRECTORY..." else - echo "Building $DIRECTORY with tag $TAG" + echo "Checking $DIRECTORY with tag $TAG..." fi -# Show sphinx-build invocation for easy reproduction -set -x -sphinx-build -E -W -b html $TAG_OPT $DIRECTORY/source $BUILD_DIR -set +x -# Copy RST -if [ "$TARGET" != "" ] ; then - mkdir -p publish-docs/$TARGET - rsync -a $BUILD_DIR/ publish-docs/$TARGET/ +if [ "$LINKCHECK" = "1" ] ; then + # Show sphinx-build invocation for easy reproduction + set -x + sphinx-build -E -W -b linkcheck $TAG_OPT $DIRECTORY/source $BUILD_DIR + set +x +else + # Show sphinx-build invocation for easy reproduction + set -x + sphinx-build -E -W -b html $TAG_OPT $DIRECTORY/source $BUILD_DIR + set +x + + # Copy RST + if [ "$TARGET" != "" ] ; then + mkdir -p publish-docs/$TARGET + rsync -a $BUILD_DIR/ publish-docs/$TARGET/ + fi fi