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
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Copyright 2013 IBM Corp.
|
||||||
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
@ -16,10 +18,7 @@
|
|||||||
# and push to Gerrit.
|
# and push to Gerrit.
|
||||||
|
|
||||||
PROJECT="openstack-manuals"
|
PROJECT="openstack-manuals"
|
||||||
DocNameList="basic-install cli-guide common openstack-block-storage-admin \
|
DocFolder="doc/src/docbkx"
|
||||||
openstack-compute-admin openstack-ha openstack-install \
|
|
||||||
openstack-network-connectivity-admin openstack-object-storage-admin \
|
|
||||||
openstack-ops"
|
|
||||||
|
|
||||||
COMMIT_MSG="Imported Translations from Transifex"
|
COMMIT_MSG="Imported Translations from Transifex"
|
||||||
|
|
||||||
@ -52,26 +51,30 @@ fi
|
|||||||
# tx init --host=https://www.transifex.com
|
# tx init --host=https://www.transifex.com
|
||||||
|
|
||||||
# generate pot one by one
|
# generate pot one by one
|
||||||
for DOCNAME in ${DocNameList}
|
for FILE in ${DocFolder}/*
|
||||||
do
|
do
|
||||||
|
DOCNAME=${FILE#${DocFolder}/}
|
||||||
# openstack-ha needs to create new DocBook files
|
# openstack-ha needs to create new DocBook files
|
||||||
if [ "$DOCNAME" == "openstack-ha" ]
|
if [ "$DOCNAME" == "openstack-ha" ]
|
||||||
then
|
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 - \
|
| xsltproc -o - /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl - \
|
||||||
| xmllint --format - | sed -e 's,<book,<book xml:id="bk-ha-guide",' \
|
| 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,' \
|
| 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
|
fi
|
||||||
# Update the .pot file
|
# Update the .pot file
|
||||||
./tools/generatepot ${DOCNAME}
|
./tools/generatepot ${DOCNAME}
|
||||||
|
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]
|
||||||
|
then
|
||||||
# Add all changed files to git
|
# Add all changed files to git
|
||||||
git add doc/src/docbkx/${DOCNAME}/locale/*
|
git add ${DocFolder}/${DOCNAME}/locale/*
|
||||||
# Set auto-local
|
# Set auto-local
|
||||||
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||||
"doc/src/docbkx/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
||||||
--source-file doc/src/docbkx/${DOCNAME}/locale/${DOCNAME}.pot \
|
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
|
||||||
-t PO --execute
|
-t PO --execute
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! `git diff --cached --quiet HEAD --` ]
|
if [ ! `git diff --cached --quiet HEAD --` ]
|
||||||
@ -83,9 +86,13 @@ fi
|
|||||||
# Pull all upstream translations
|
# Pull all upstream translations
|
||||||
tx pull -a
|
tx pull -a
|
||||||
|
|
||||||
for DOCNAME in ${DocNameList}
|
for FILE in ${DocFolder}/*
|
||||||
do
|
do
|
||||||
git add doc/src/docbkx/${DOCNAME}/locale/*
|
DOCNAME=${FILE#${DocFolder}/}
|
||||||
|
if [ -d ${DocFolder}/${DOCNAME}/locale ]
|
||||||
|
then
|
||||||
|
git add ${DocFolder}/${DOCNAME}/locale/*
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Don't send a review if the only things which have changed are the creation
|
# Don't send a review if the only things which have changed are the creation
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash -xe
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Copyright 2013 IBM Corp.
|
||||||
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
@ -14,10 +16,7 @@
|
|||||||
|
|
||||||
# The script is to push the updated PoT to Transifex.
|
# The script is to push the updated PoT to Transifex.
|
||||||
|
|
||||||
DocNameList="basic-install cli-guide common openstack-block-storage-admin \
|
DocFolder="doc/src/docbkx"
|
||||||
openstack-compute-admin openstack-ha openstack-install \
|
|
||||||
openstack-network-connectivity-admin openstack-object-storage-admin \
|
|
||||||
openstack-ops"
|
|
||||||
|
|
||||||
if [ ! `echo $ZUUL_REFNAME | grep master` ]
|
if [ ! `echo $ZUUL_REFNAME | grep master` ]
|
||||||
then
|
then
|
||||||
@ -32,26 +31,30 @@ git config user.email "jenkins@openstack.org"
|
|||||||
# tx init --host=https://www.transifex.com
|
# tx init --host=https://www.transifex.com
|
||||||
|
|
||||||
# generate pot one by one
|
# generate pot one by one
|
||||||
for DOCNAME in ${DocNameList}
|
for FILE in ${DocFolder}/*
|
||||||
do
|
do
|
||||||
|
DOCNAME=${FILE#${DocFolder}/}
|
||||||
# openstack-ha needs to create new DocBook files
|
# openstack-ha needs to create new DocBook files
|
||||||
if [ "$DOCNAME" == "openstack-ha" ]
|
if [ "$DOCNAME" == "openstack-ha" ]
|
||||||
then
|
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 - \
|
| xsltproc -o - /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl - \
|
||||||
| xmllint --format - | sed -e 's,<book,<book xml:id="bk-ha-guide",' \
|
| 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,' \
|
| 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
|
fi
|
||||||
# Update the .pot file
|
# Update the .pot file
|
||||||
./tools/generatepot ${DOCNAME}
|
./tools/generatepot ${DOCNAME}
|
||||||
|
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]
|
||||||
|
then
|
||||||
# Add all changed files to git
|
# Add all changed files to git
|
||||||
git add doc/src/docbkx/${DOCNAME}/locale/*
|
git add ${DocFolder}/${DOCNAME}/locale/*
|
||||||
# Set auto-local
|
# Set auto-local
|
||||||
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||||
"doc/src/docbkx/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
||||||
--source-file doc/src/docbkx/${DOCNAME}/locale/${DOCNAME}.pot \
|
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
|
||||||
-t PO --execute
|
-t PO --execute
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! `git diff --cached --quiet HEAD --` ]
|
if [ ! `git diff --cached --quiet HEAD --` ]
|
||||||
|
Loading…
Reference in New Issue
Block a user