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