Merge "Add linkcheck for RST"

This commit is contained in:
Jenkins 2015-08-25 17:21:40 +00:00 committed by Gerrit Code Review
commit b68c6db7e0
5 changed files with 55 additions and 20 deletions

View File

@ -209,6 +209,9 @@ htmlhelp_basename = 'user-guide'
# If true, publish source files # If true, publish source files
# html_copy_source = True # html_copy_source = True
# -- Options for linkcheck ------------------------------------------------
linkcheck_ignore = [r'https://build.opensuse.org']
# -- Options for LaTeX output --------------------------------------------- # -- Options for LaTeX output ---------------------------------------------
latex_elements = { latex_elements = {

View File

@ -4,9 +4,16 @@ mkdir -p publish-docs
GLOSSARY="--glossary" GLOSSARY="--glossary"
LINKCHECK=""
if [[ $# > 0 ]] ; then
if [ "$1" = "--linkcheck" ] ; then
LINKCHECK="$1"
fi
fi
for guide in user-guide user-guide-admin networking-guide admin-guide-cloud; do for guide in user-guide user-guide-admin networking-guide admin-guide-cloud; do
tools/build-rst.sh doc/$guide $GLOSSARY --build build \ tools/build-rst.sh doc/$guide $GLOSSARY --build build \
--target $guide --target $guide $LINKCHECK
# Build it only the first time # Build it only the first time
GLOSSARY="" GLOSSARY=""
done done
@ -14,7 +21,7 @@ done
# Draft guides # Draft guides
for guide in contributor-guide; do for guide in contributor-guide; do
tools/build-rst.sh doc/$guide --build build \ tools/build-rst.sh doc/$guide --build build \
--target "draft/$guide" --target "draft/$guide" $LINKCHECK
done done
tools/build-install-guides-rst.sh tools/build-install-guides-rst.sh $LINKCHECK

View File

@ -2,6 +2,13 @@
mkdir -p publish-docs mkdir -p publish-docs
LINKCHECK=""
if [[ $# > 0 ]] ; then
if [ "$1" = "--linkcheck" ] ; then
LINKCHECK="$1"
fi
fi
title_org=$(grep "title::" doc/install-guide/source/index.rst | \ title_org=$(grep "title::" doc/install-guide/source/index.rst | \
awk '{print substr($0, index($0, "::")+3)}') awk '{print substr($0, index($0, "::")+3)}')
@ -19,7 +26,8 @@ for tag in obs rdo ubuntu debian; do
sed -i -e "s/\.\. title::.*/.. title:: ${title}/" \ sed -i -e "s/\.\. title::.*/.. title:: ${title}/" \
doc/install-guide/source/index.rst doc/install-guide/source/index.rst
tools/build-rst.sh doc/install-guide \ tools/build-rst.sh doc/install-guide \
$GLOSSARY --tag ${tag} --target "draft/install-guide-${tag}" $GLOSSARY --tag ${tag} --target "draft/install-guide-${tag}" \
$LINKCHECK
done done
# Debian uses index-debian, rename it. # Debian uses index-debian, rename it.

View File

@ -21,6 +21,7 @@ if [ -z "$DIRECTORY" ] ; then
echo "--tag TAG: Use given tag for building" echo "--tag TAG: Use given tag for building"
echo "--target TARGET: Copy files to publish-docs/$TARGET" echo "--target TARGET: Copy files to publish-docs/$TARGET"
echo "--build BUILD: Name of build directory" echo "--build BUILD: Name of build directory"
echo "--linkcheck: Check validity of links instead of building"
exit 1 exit 1
fi fi
@ -29,10 +30,18 @@ TARGET=""
TAG="" TAG=""
TAG_OPT="" TAG_OPT=""
BUILD="" BUILD=""
LINKCHECK=""
while [[ $# > 1 ]] ; do while [[ $# > 0 ]] ; do
option="$1" option="$1"
case $option in case $option in
--build)
BUILD="$2"
shift
;;
--linkcheck)
LINKCHECK=1
;;
--glossary) --glossary)
GLOSSARY=1 GLOSSARY=1
;; ;;
@ -45,10 +54,6 @@ while [[ $# > 1 ]] ; do
TARGET="$2" TARGET="$2"
shift shift
;; ;;
--build)
BUILD="$2"
shift
;;
esac esac
shift shift
done done
@ -70,17 +75,25 @@ else
fi fi
if [ -z "$TAG" ] ; then if [ -z "$TAG" ] ; then
echo "Building $DIRECTORY" echo "Checking $DIRECTORY..."
else else
echo "Building $DIRECTORY with tag $TAG" echo "Checking $DIRECTORY with tag $TAG..."
fi 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 [ "$LINKCHECK" = "1" ] ; then
if [ "$TARGET" != "" ] ; then # Show sphinx-build invocation for easy reproduction
mkdir -p publish-docs/$TARGET set -x
rsync -a $BUILD_DIR/ publish-docs/$TARGET/ 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 fi

View File

@ -1,6 +1,6 @@
[tox] [tox]
minversion = 1.6 minversion = 1.6
envlist = checkniceness,checksyntax,checkdeletions,checkbuild,checklang,checklinks envlist = checkniceness,checksyntax,checkdeletions,checkbuild,checklinks
skipsdist = True skipsdist = True
[testenv] [testenv]
@ -21,6 +21,10 @@ commands = {posargs}
[testenv:checklinks] [testenv:checklinks]
commands = openstack-doc-test --check-links {posargs} commands = openstack-doc-test --check-links {posargs}
[testenv:linkcheck]
commands =
{toxinidir}/tools/build-all-rst.sh --linkcheck
[testenv:checkniceness] [testenv:checkniceness]
commands = commands =
openstack-doc-test --check-niceness {posargs} openstack-doc-test --check-niceness {posargs}