doc-tools: Build in parallel with NUMBER_OF_CORES processes
Change-Id: I7f820d80069f2b98c35f6f0cc1d2dbe9ed2b2cc7
This commit is contained in:
parent
2ff4c542dd
commit
93f070ec6b
|
@ -32,6 +32,12 @@ TAG_OPT=""
|
|||
BUILD=""
|
||||
LINKCHECK=""
|
||||
|
||||
if [ -x "$(command -v getconf)" ]; then
|
||||
NUMBER_OF_CORES=$(getconf _NPROCESSORS_ONLN)
|
||||
else
|
||||
NUMBER_OF_CORES=2
|
||||
fi
|
||||
|
||||
while [[ $# > 0 ]] ; do
|
||||
option="$1"
|
||||
case $option in
|
||||
|
@ -85,14 +91,14 @@ fi
|
|||
if [ "$LINKCHECK" = "1" ] ; then
|
||||
# Show sphinx-build invocation for easy reproduction
|
||||
set -x
|
||||
sphinx-build -E -W -d $DOCTREES -b linkcheck $TAG_OPT \
|
||||
$DIRECTORY/source $BUILD_DIR
|
||||
sphinx-build -j $NUMBER_OF_CORES -E -W -d $DOCTREES -b linkcheck \
|
||||
$TAG_OPT $DIRECTORY/source $BUILD_DIR
|
||||
set +x
|
||||
else
|
||||
# Show sphinx-build invocation for easy reproduction
|
||||
set -x
|
||||
sphinx-build -E -W -d $DOCTREES -b html $TAG_OPT \
|
||||
$DIRECTORY/source $BUILD_DIR
|
||||
sphinx-build -j $NUMBER_OF_CORES -E -W -d $DOCTREES -b html \
|
||||
$TAG_OPT $DIRECTORY/source $BUILD_DIR
|
||||
set +x
|
||||
|
||||
# Copy RST
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
|
||||
BUILD_FAIL=0
|
||||
|
||||
if [ -x "$(command -v getconf)" ]; then
|
||||
NUMBER_OF_CORES=$(getconf _NPROCESSORS_ONLN)
|
||||
else
|
||||
NUMBER_OF_CORES=2
|
||||
fi
|
||||
|
||||
function setup_directories {
|
||||
language=$1
|
||||
for directory in ${DIRECTORIES["$language"]} ; do
|
||||
|
@ -51,7 +57,7 @@ function build_rst {
|
|||
if [ ${book} = "install-guide" ] ; then
|
||||
TAG="-t obs -t rdo -t ubuntu -t debian"
|
||||
fi
|
||||
tox -evenv "sphinx-build -q -E -W -b gettext $TAG ${DOC_DIR}${book}/source/ \
|
||||
tox -evenv "sphinx-build -j $NUMBER_OF_CORES -q -E -W -b gettext $TAG ${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/source/locale/"
|
||||
|
||||
# Merge the common-rst po file in
|
||||
|
@ -82,7 +88,7 @@ function build_rst {
|
|||
if [ ${book} = "firstapp" ] ; then
|
||||
# Firstapp has several variations, build all of them
|
||||
for tag in libcloud dotnet fog pkgcloud shade; do
|
||||
tox -evenv "sphinx-build -q -E -t $tag -D language=${language} \
|
||||
tox -evenv "sphinx-build -j $NUMBER_OF_CORES -q -E -t $tag -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build-${tag}/html"
|
||||
mkdir -p publish-docs/${language}/${book}-${tag}
|
||||
|
@ -103,7 +109,7 @@ function build_rst {
|
|||
sed -n 4p | sed -e 's/^ *//g')
|
||||
sed -i -e "s/\.\. title::.*/.. title:: ${title}/" \
|
||||
${DOC_DIR}${book}/source/index.rst
|
||||
tox -evenv "sphinx-build -q -E -t $tag -D language=${language} \
|
||||
tox -evenv "sphinx-build -j $NUMBER_OF_CORES -q -E -t $tag -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build-${tag}/html"
|
||||
mkdir -p publish-docs/${language}/${book}-${tag}
|
||||
|
@ -117,7 +123,7 @@ function build_rst {
|
|||
${INSTALL_DEBIAN}/index.html
|
||||
fi
|
||||
else
|
||||
tox -evenv "sphinx-build -q -E -D language=${language} \
|
||||
tox -evenv "sphinx-build -j $NUMBER_OF_CORES -q -E -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build/html"
|
||||
mkdir -p publish-docs/${language}/${book}/
|
||||
|
|
Loading…
Reference in New Issue