Build all Install Guides and HA Guide in gates

Build books the same way we build them for publishing:

Build all three variants of the Install Guides if we check building.
Since we introduce os specific sections, the guide might build for one
variant but not the others.

In case of failure, the variant is shown like:
Building all queued 1 books now...
>>> Build of book install-guide (for Ubuntu) failed (returncode = 1).

Also, generate the xml file for the HA guide and build it.

Add generated file bk-ha-guide.xml to .gitignore

Add parameter -B for building to mvn to silence download progress

Run test.py and validate.py through pep8 and fix any issues

Change-Id: Icfb4587e7c08050d1b65dddc5a3a810a8bf12f5a
This commit is contained in:
Andreas Jaeger 2013-09-30 21:18:48 +02:00
parent dfdcdcb374
commit 40a73e6db8
4 changed files with 126 additions and 15 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ target/
*.swp
.idea
*~
bk-ha-guide.xml

25
tools/build-ha-guide.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# This script needs to be called from the doc/high-availibilty-guide
# directory!
# Find location of db4-upgrade-xsl:
if [ -e /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl ] ; then
DB_UPGRADE=/usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl
elif [ -e /usr/share/xml/docbook/stylesheet/upgrade/db4-upgrade.xsl ] ; then
DB_UPGRADE=/usr/share/xml/docbook/stylesheet/upgrade/db4-upgrade.xsl
else
echo "db4-upgrade.xsl not found"
exit 1
fi
type -P asciidoc > /dev/null 2>&1 || { echo >&2 "asciidoc not installed. Aborting."; exit 1; }
type -P xsltproc > /dev/null 2>&1 || { echo >&2 "xsltproc not installed. Aborting."; exit 1; }
type -P xmllint > /dev/null 2>&1 || { echo >&2 "xmllint not installed. Aborting."; exit 1; }
asciidoc -b docbook -d book -o - ha-guide.txt | \
xsltproc -o - $DB_UPGRADE - | \
xmllint --format - | \
sed -e 's,<book,<book xml:id="bk-ha-guide",' | \
sed -e 's,<info,<?rax pdf.url="../openstack-ha-guide-trunk.pdf"?><info,' \
> bk-ha-guide.xml

View File

@ -363,24 +363,66 @@ def logging_build_book(result):
def build_book(book):
"""Build a single book"""
"""Build book(s) in directory book"""
os.chdir(book)
result = True
returncode = 0
base_book = os.path.basename(book)
try:
shutil.rmtree(os.path.expanduser("~/.fop"),
ignore_errors=True)
# Clean first and then build so that the output of all guides
# is available
output = subprocess.check_output(
["mvn", "clean", "generate-sources"],
["mvn", "clean"],
stderr=subprocess.STDOUT
)
if base_book == "install-guide":
# Build Fedora
base_book = "install-guide (for Fedora)"
output = subprocess.check_output(
["mvn", "generate-sources", "-B",
"-Doperating.system=yum",
"-Dprofile.os='centos;fedora;rhel'"],
stderr=subprocess.STDOUT
)
# Build openSUSE
base_book = "install-guide (for openSUSE)"
output = subprocess.check_output(
["mvn", "generate-sources", "-B",
"-Doperating.system=zypper", "-Dprofile.os=opensuse"],
stderr=subprocess.STDOUT
)
# Build Ubuntu
base_book = "install-guide (for Ubuntu)"
output = subprocess.check_output(
["mvn", "generate-sources", "-B",
"-Doperating.system=apt", "-Dprofile.os=ubuntu"],
stderr=subprocess.STDOUT
)
# Success
base_book = "install-guide (for Fedora, openSUSE, Ubuntu)"
elif base_book == "high-availability-guide":
output = subprocess.check_output(
["../../tools/build-ha-guide.sh", ],
stderr=subprocess.STDOUT
)
output = subprocess.check_output(
["mvn", "generate-sources", "-B"],
stderr=subprocess.STDOUT
)
else:
output = subprocess.check_output(
["mvn", "generate-sources", "-B"],
stderr=subprocess.STDOUT
)
except subprocess.CalledProcessError as e:
output = e.output
returncode = e.returncode
result = False
return (os.path.basename(book), result, output, returncode)
return (base_book, result, output, returncode)
def build_affected_books(rootdir, book_exceptions, file_exceptions,
@ -494,6 +536,7 @@ def build_affected_books(rootdir, book_exceptions, file_exceptions,
sys.exit(1)
print("Building finished.")
def main(args):
if args.check_all:

View File

@ -356,24 +356,66 @@ def logging_build_book(result):
def build_book(book):
"""Build a single book"""
"""Build book(s) in directory book"""
os.chdir(book)
result = True
returncode = 0
base_book = os.path.basename(book)
try:
shutil.rmtree(os.path.expanduser("~/.fop"),
ignore_errors=True)
# Clean first and then build so that the output of all guides
# is available
output = subprocess.check_output(
["mvn", "clean", "generate-sources"],
["mvn", "clean"],
stderr=subprocess.STDOUT
)
if base_book == "install-guide":
# Build Fedora
base_book = "install-guide (for Fedora)"
output = subprocess.check_output(
["mvn", "generate-sources", "-B",
"-Doperating.system=yum",
"-Dprofile.os='centos;fedora;rhel'"],
stderr=subprocess.STDOUT
)
# Build openSUSE
base_book = "install-guide (for openSUSE)"
output = subprocess.check_output(
["mvn", "generate-sources", "-B",
"-Doperating.system=zypper", "-Dprofile.os=opensuse"],
stderr=subprocess.STDOUT
)
# Build Ubuntu
base_book = "install-guide (for Ubuntu)"
output = subprocess.check_output(
["mvn", "generate-sources", "-B",
"-Doperating.system=apt", "-Dprofile.os=ubuntu"],
stderr=subprocess.STDOUT
)
# Success
base_book = "install-guide (for Fedora, openSUSE, Ubuntu)"
elif base_book == "high-availability-guide":
output = subprocess.check_output(
["../../tools/build-ha-guide.sh", ],
stderr=subprocess.STDOUT
)
output = subprocess.check_output(
["mvn", "generate-sources", "-B"],
stderr=subprocess.STDOUT
)
else:
output = subprocess.check_output(
["mvn", "generate-sources", "-B"],
stderr=subprocess.STDOUT
)
except subprocess.CalledProcessError as e:
output = e.output
returncode = e.returncode
result = False
return (os.path.basename(book), result, output, returncode)
return (base_book, result, output, returncode)
def build_affected_books(rootdir, book_exceptions, file_exceptions, force):