Really fix translations copy

We cannot create the .translation-source directory before pushing to
zanata, otherwise the zanata-cli will push the .translation-source
directory as well.

Instead collect modulenames and do copying at end.

Reference:
http://logs.openstack.org/e4/e49717dd71bbaf0e9ca2303206037edc56fbe689/post/nova-upstream-translation-update/3d5f20e/console.html#_2016-05-06_21_30_33_017

Change-Id: I21ad03d1d227964e0709ef99613eaa060fee7158
This commit is contained in:
Andreas Jaeger 2016-05-06 23:42:48 +02:00
parent 62ab336db7
commit fa58d76612
2 changed files with 21 additions and 18 deletions

View File

@ -578,13 +578,14 @@ function pull_from_zanata {
# Copy all pot files in modulename directory to temporary path for # Copy all pot files in modulename directory to temporary path for
# publishing. This uses the exact same path. # publishing. This uses the exact same path.
function copy_pot { function copy_pot {
local modulename=$1 local all_modules=$1
local target=.translation-source/$PROJECT/$ZANATA_VERSION/ local target=.translation-source/$PROJECT/$ZANATA_VERSION/
for f in `find $modulename -name "*.pot" ` ; do for m in $all_modules ; do
local fd=$(dirname $f) for f in `find $m -name "*.pot" ` ; do
mkdir -p $target/$fd local fd=$(dirname $f)
cp $f $target/$f mkdir -p $target/$fd
cp $f $target/$f
done
done done
} }

View File

@ -22,6 +22,9 @@ source /usr/local/jenkins/slave_scripts/common_translation_update.sh
init_branch $ZUUL_REFNAME init_branch $ZUUL_REFNAME
# List of all modules to copy POT files from
ALL_MODULES=""
if ! /usr/local/jenkins/slave_scripts/query-zanata-project-version.py \ if ! /usr/local/jenkins/slave_scripts/query-zanata-project-version.py \
-p $PROJECT -v $ZANATA_VERSION; then -p $PROJECT -v $ZANATA_VERSION; then
# Exit successfully so that lack of a version doesn't cause the jenkins # Exit successfully so that lack of a version doesn't cause the jenkins
@ -40,26 +43,23 @@ case "$PROJECT" in
setup_manuals "$PROJECT" "$ZANATA_VERSION" setup_manuals "$PROJECT" "$ZANATA_VERSION"
case "$PROJECT" in case "$PROJECT" in
api-site) api-site)
copy_pot "api-quick-start" ALL_MODULES="api-quick-start api-ref-guides api-ref firstapp"
copy_pot "api-ref-guides"
copy_pot "api-ref"
copy_pot "firstapp"
;; ;;
security-doc) security-doc)
copy_pot "security-guide" ALL_MODULES="security-guide"
;; ;;
*) *)
copy_pot "doc" ALL_MODULES="doc"
;; ;;
esac esac
if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
extract_messages_releasenotes extract_messages_releasenotes
copy_pot "releasenotes" ALL_MODULES="releasenotes $ALL_MODULES"
fi fi
;; ;;
training-guides) training-guides)
setup_training_guides "$ZANATA_VERSION" setup_training_guides "$ZANATA_VERSION"
copy_pot "doc" ALL_MODULES="doc"
;; ;;
*) *)
# Common setup for python and django repositories # Common setup for python and django repositories
@ -71,11 +71,11 @@ case "$PROJECT" in
setup_loglevel_vars setup_loglevel_vars
if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
extract_messages_releasenotes extract_messages_releasenotes
copy_pot "releasenotes" ALL_MODULES="releasenotes $ALL_MODULES"
fi fi
for modulename in $module_names; do for modulename in $module_names; do
extract_messages_python "$modulename" extract_messages_python "$modulename"
copy_pot "$modulename" ALL_MODULES="$modulename $ALL_MODULES"
done done
fi fi
@ -86,11 +86,11 @@ case "$PROJECT" in
install_horizon install_horizon
if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
extract_messages_releasenotes extract_messages_releasenotes
copy_pot "releasenotes" ALL_MODULES="releasenotes $ALL_MODULES"
fi fi
for modulename in $module_names; do for modulename in $module_names; do
extract_messages_django "$modulename" extract_messages_django "$modulename"
copy_pot "$modulename" ALL_MODULES="$modulename $ALL_MODULES"
done done
fi fi
;; ;;
@ -116,5 +116,7 @@ if [ $(git diff --cached | egrep -v "(POT-Creation-Date|^[\+\-]#|^\+{3}|^\-{3})"
# Do not copy translations from other files for this change. # Do not copy translations from other files for this change.
zanata-cli -B -e push --copy-trans False zanata-cli -B -e push --copy-trans False
# Move pot files to translation-source directory for publishing # Move pot files to translation-source directory for publishing
copy_pot "$ALL_MODULES"
mv .translation-source translation-source mv .translation-source translation-source
fi fi