Improve the robustness of manuals translation scripts
Add codes to get the list of document's names in openstack manuals, other than hard code. Check whether the files/folders exist before taking actions, to improve the robustness. bug 1195180 Change-Id: I3e3d17a77920c99bed6881ac0cc460b1fce54cea Reviewed-on: https://review.openstack.org/34700 Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Reviewed-by: James E. Blair <corvus@inaugust.com> Approved: Clark Boylan <clark.boylan@gmail.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Tested-by: Jenkins
This commit is contained in:
parent
cf06134ea4
commit
94b59469d8
@ -1,5 +1,7 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
# Copyright 2013 IBM Corp.
|
||||
#
|
||||
# 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
|
||||
@ -16,10 +18,7 @@
|
||||
# and push to Gerrit.
|
||||
|
||||
PROJECT="openstack-manuals"
|
||||
DocNameList="basic-install cli-guide common openstack-block-storage-admin \
|
||||
openstack-compute-admin openstack-ha openstack-install \
|
||||
openstack-network-connectivity-admin openstack-object-storage-admin \
|
||||
openstack-ops"
|
||||
DocFolder="doc/src/docbkx"
|
||||
|
||||
COMMIT_MSG="Imported Translations from Transifex"
|
||||
|
||||
@ -52,26 +51,30 @@ fi
|
||||
# tx init --host=https://www.transifex.com
|
||||
|
||||
# generate pot one by one
|
||||
for DOCNAME in ${DocNameList}
|
||||
for FILE in ${DocFolder}/*
|
||||
do
|
||||
DOCNAME=${FILE#${DocFolder}/}
|
||||
# openstack-ha needs to create new DocBook files
|
||||
if [ "$DOCNAME" == "openstack-ha" ]
|
||||
then
|
||||
asciidoc -b docbook -d book -o - doc/src/docbkx/openstack-ha/ha-guide.txt \
|
||||
asciidoc -b docbook -d book -o - ${DocFolder}/openstack-ha/ha-guide.txt \
|
||||
| xsltproc -o - /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl - \
|
||||
| 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,' \
|
||||
> doc/src/docbkx/openstack-ha/bk-ha-guide.xml
|
||||
> ${DocFolder}/openstack-ha/bk-ha-guide.xml
|
||||
fi
|
||||
# Update the .pot file
|
||||
./tools/generatepot ${DOCNAME}
|
||||
# Add all changed files to git
|
||||
git add doc/src/docbkx/${DOCNAME}/locale/*
|
||||
# Set auto-local
|
||||
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||
"doc/src/docbkx/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
||||
--source-file doc/src/docbkx/${DOCNAME}/locale/${DOCNAME}.pot \
|
||||
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]
|
||||
then
|
||||
# Add all changed files to git
|
||||
git add ${DocFolder}/${DOCNAME}/locale/*
|
||||
# Set auto-local
|
||||
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
||||
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
|
||||
-t PO --execute
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! `git diff --cached --quiet HEAD --` ]
|
||||
@ -83,9 +86,13 @@ fi
|
||||
# Pull all upstream translations
|
||||
tx pull -a
|
||||
|
||||
for DOCNAME in ${DocNameList}
|
||||
for FILE in ${DocFolder}/*
|
||||
do
|
||||
git add doc/src/docbkx/${DOCNAME}/locale/*
|
||||
DOCNAME=${FILE#${DocFolder}/}
|
||||
if [ -d ${DocFolder}/${DOCNAME}/locale ]
|
||||
then
|
||||
git add ${DocFolder}/${DOCNAME}/locale/*
|
||||
fi
|
||||
done
|
||||
|
||||
# Don't send a review if the only things which have changed are the creation
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
# Copyright 2013 IBM Corp.
|
||||
#
|
||||
# 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
|
||||
@ -14,10 +16,7 @@
|
||||
|
||||
# The script is to push the updated PoT to Transifex.
|
||||
|
||||
DocNameList="basic-install cli-guide common openstack-block-storage-admin \
|
||||
openstack-compute-admin openstack-ha openstack-install \
|
||||
openstack-network-connectivity-admin openstack-object-storage-admin \
|
||||
openstack-ops"
|
||||
DocFolder="doc/src/docbkx"
|
||||
|
||||
if [ ! `echo $ZUUL_REFNAME | grep master` ]
|
||||
then
|
||||
@ -32,26 +31,30 @@ git config user.email "jenkins@openstack.org"
|
||||
# tx init --host=https://www.transifex.com
|
||||
|
||||
# generate pot one by one
|
||||
for DOCNAME in ${DocNameList}
|
||||
for FILE in ${DocFolder}/*
|
||||
do
|
||||
DOCNAME=${FILE#${DocFolder}/}
|
||||
# openstack-ha needs to create new DocBook files
|
||||
if [ "$DOCNAME" == "openstack-ha" ]
|
||||
then
|
||||
asciidoc -b docbook -d book -o - doc/src/docbkx/openstack-ha/ha-guide.txt \
|
||||
asciidoc -b docbook -d book -o - ${DocFolder}/openstack-ha/ha-guide.txt \
|
||||
| xsltproc -o - /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl - \
|
||||
| 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,' \
|
||||
> doc/src/docbkx/openstack-ha/bk-ha-guide.xml
|
||||
> ${DocFolder}/openstack-ha/bk-ha-guide.xml
|
||||
fi
|
||||
# Update the .pot file
|
||||
./tools/generatepot ${DOCNAME}
|
||||
# Add all changed files to git
|
||||
git add doc/src/docbkx/${DOCNAME}/locale/*
|
||||
# Set auto-local
|
||||
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||
"doc/src/docbkx/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
||||
--source-file doc/src/docbkx/${DOCNAME}/locale/${DOCNAME}.pot \
|
||||
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]
|
||||
then
|
||||
# Add all changed files to git
|
||||
git add ${DocFolder}/${DOCNAME}/locale/*
|
||||
# Set auto-local
|
||||
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
||||
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
|
||||
-t PO --execute
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! `git diff --cached --quiet HEAD --` ]
|
||||
|
Loading…
Reference in New Issue
Block a user