Unify checkbuild and publishdocs

The two tox environments were large and mostly duplicated, use a shell
script instead and use the build-rst.sh script to simplify building and
publishing.

For copying to /kilo, use the tools/copy-to-branch.sh script instead of
the simple commands since that is more robust. Merge that script into
this script, no need for a second script.

Update requirements: We need 0.27 at least to not have to delete the
Debian Install Guide, sync also pbr with global-requirements.txt.

Change-Id: Ieba77b4e3d0bbe58db041206d9725c523b3bb43a
This commit is contained in:
Andreas Jaeger 2015-05-10 08:39:34 +02:00
parent 282be5d7bd
commit 1713dabf56
4 changed files with 76 additions and 94 deletions

View File

@ -1,14 +1,14 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=0.6,!=0.7,<1.0
pbr>=0.11,<2.0
# Hacking already pins down pep8, pyflakes and flake8
hacking>=0.10.0,<0.11
beautifulsoup4
Jinja2>=2.6 # BSD License (3 clause)
openstack-doc-tools>=0.26
openstack-doc-tools>=0.27
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
openstackdocstheme>=1.0.7
doc8 # Apache-2.0

View File

@ -1,36 +0,0 @@
#!/bin/bash -xe
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Copy files from trunk to named branch and replace all links from
# trunk with links to the branch
BRANCH=$1
if [ -z "$BRANCH" ] ; then
echo "usage $0 BRANCH"
exit 1
fi
if [ -e publish-docs/trunk ] ; then
# Copy files over
cp -a publish-docs/trunk publish-docs/$BRANCH
for f in $(find publish-docs/$BRANCH -name "atom.xml") ; do
sed -i -e "s|/trunk/|/$BRANCH/|g" $f
done
for f in $(find publish-docs/$BRANCH -name "*.html") ; do
sed -i -e "s|/trunk/|/$BRANCH/|g" $f
done
fi

72
tools/publishdocs.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash -xe
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
PUBLISH=$1
if [[ -z "$PUBLISH" ]] ; then
echo "usage $0 (publish|check)"
exit 1
fi
# Copy files from draft to named branch and replace all links from
# draft with links to the branch
function copy_to_branch {
BRANCH=$1
if [ -e publish-docs/draft ] ; then
# Copy files over
cp -a publish-docs/draft publish-docs/$BRANCH
for f in $(find publish-docs/$BRANCH -name "atom.xml"); do
sed -i -e "s|/draft/|/$BRANCH/|g" $f
done
for f in $(find publish-docs/$BRANCH -name "*.html"); do
sed -i -e "s|/draft/|/$BRANCH/|g" $f
done
fi
}
mkdir -p publish-docs
# Build End User Guide
tools/build-rst.sh doc/user-guide --glossary --tag user_only --build build \
--target user-guide
# Build Admin User Guide
# No need to build the glossary again here.
tools/build-rst.sh doc/user-guide-admin --tag admin_only --build build \
--target user-guide-admin
# Build Networking Guide
tools/build-rst.sh doc/networking-guide --build build \
--target networking-guide
# Build the www pages so that openstack-doc-test creates a link to
# www/www-index.html.
python tools/www-generator.py --source-directory www/ --output-directory publish-docs/
rsync -a www/static/ publish-docs/
if [ "$PUBLISH" = "publish" ] ; then
# Don't publish this file
rm publish-docs/www-index.html
fi
# We only publish changed manuals.
if [ "$PUBLISH" = "publish" ] ; then
openstack-doc-test --check-build --publish
# For publishing to both /draft and /BRANCH
copy_to_branch kilo
else
openstack-doc-test --check-build
fi

58
tox.ini
View File

@ -38,27 +38,7 @@ commands = openstack-doc-test --check-deletions {posargs}
[testenv:checkbuild]
commands =
# Build first the www pages so that openstack-doc-test creates a link to
# www/www-index.html.
mkdir -p publish-docs/www
python tools/www-generator.py --source-directory www/ --output-directory publish-docs/www/
cp www/www-index.html publish-docs/
rsync -a www/static/ publish-docs/www/
# Build and copy RST Guides
# Build both RST User Guides
{toxinidir}/tools/build-user-guides.sh
# Copy RST user-guide
mkdir -p publish-docs/user-guide/
rsync -a doc/user-guide/build/html/ publish-docs/user-guide/
# Copy RST user-guide-admin
mkdir -p publish-docs/user-guide-admin/
rsync -a doc/user-guide-admin/build/html/ publish-docs/user-guide-admin/
# Build RST networking guide
sphinx-build -E -W doc/networking-guide/source doc/networking-guide/build/html
mkdir -p publish-docs/networking-guide/
rsync -a doc/networking-guide/build/html/ publish-docs/networking-guide/
# Build DocBook Guides
openstack-doc-test --check-build {posargs}
{toxinidir}/tools/publishdocs.sh build
[testenv:docs]
commands =
@ -75,41 +55,7 @@ commands =
# published on docs.openstack.org with just copying publish-docs/*
# over.
commands =
# Create directory, it might not be here if openstack-doc-test does
# not publish anything.
mkdir -p publish-docs
# We only publish changed manuals.
openstack-doc-test --check-build --publish
# TODO(jaegerandi): Remove the following lines before we branch off
# a kilo branch.
# Do not publish Debian guide
rm -rf publish-docs/draft/install-guide/install/apt-debian
# Publish install-guide and config-reference to /kilo
bash -c "cp -a publish-docs/draft publish-docs/kilo || true"
# Replace links to /draft with links to /kilo/
# This needs bash so that tox does not interpret the *
bash -c "sed -i -e 's|/draft/|/kilo/|g' publish-docs/kilo/*/atom.xml publish-docs/kilo/*/*/*/atom.xml publish-docs/kilo/*/*.html publish-docs/kilo/*/*/*/*/*.html publish-docs/kilo/*/*/*/*.html publish-docs/kilo/*/*/*.html publish-docs/kilo/*/*.html || true"
# END Kilo duplication.
# Build both RST User Guides
{toxinidir}/tools/build-user-guides.sh
# Copy RST user-guide
mkdir -p publish-docs/user-guide/
rsync -a doc/user-guide/build/html/ publish-docs/user-guide/
# Copy RST user-guide-admin
mkdir -p publish-docs/user-guide-admin/
rsync -a doc/user-guide-admin/build/html/ publish-docs/user-guide-admin/
# Build RST Networking Guide
sphinx-build -W doc/networking-guide/source doc/networking-guide/build/html
# Copy RST Networking Guide
mkdir -p publish-docs/networking-guide/
rsync -a doc/networking-guide/build/html/ publish-docs/networking-guide/
# Now publish www as well, we cannot do this from
# openstack-doc-test. Use rsync so that .htaccess gets also
# copied.
python tools/www-generator.py --source-directory www/ --output-directory publish-docs/
rsync -a www/static/ publish-docs/
# Don't publish this file
rm publish-docs/www-index.html
{toxinidir}/tools/publishdocs.sh publish
[testenv:checklang]
# Generatedocbook needs xml2po which cannot be installed