Fix django_openstack_auth translation setup
The locale files and directory setup in django_openstack_auth is different from all other projects, we need to handle the translations extra. The patch adds two new slave scripts for the usual translation jobs that share setup via the common library. Two new jobs are created which are hooked into JJB and Zuul. Also, the filtering of commits has been moved from all files to the common function filter_commits. The grep in this function has been simplified. Change-Id: Id76b88b2583f3cdddecd41adce5f18363ee19e53
This commit is contained in:
parent
81ea767afc
commit
7e4c83f5a1
modules/openstack_project/files
@ -686,7 +686,6 @@
|
||||
- python-jobs
|
||||
- openstack-publish-jobs
|
||||
- pypi-jobs
|
||||
- translation-jobs
|
||||
|
||||
|
||||
- project:
|
||||
|
@ -29,6 +29,37 @@
|
||||
|
||||
node: 'proposal'
|
||||
|
||||
- job:
|
||||
name: 'django_openstack_auth-upstream-translation-update'
|
||||
|
||||
builders:
|
||||
- revoke-sudo
|
||||
- gerrit-git-prep
|
||||
- shell: |
|
||||
#!/bin/bash -xe
|
||||
/usr/local/jenkins/slave_scripts/upstream_translation_django_openstack_auth.sh
|
||||
|
||||
publishers:
|
||||
- console-log
|
||||
|
||||
node: 'proposal'
|
||||
|
||||
- job:
|
||||
name: 'django_openstack_auth-propose-translation-update'
|
||||
|
||||
builders:
|
||||
- revoke-sudo
|
||||
- branch-git-prep:
|
||||
branch: master
|
||||
- shell: |
|
||||
#!/bin/bash -xe
|
||||
/usr/local/jenkins/slave_scripts/propose_translation_update_django_openstack_auth.sh
|
||||
|
||||
publishers:
|
||||
- console-log
|
||||
|
||||
node: 'proposal'
|
||||
|
||||
- job:
|
||||
name: 'horizon-upstream-translation-update'
|
||||
|
||||
|
@ -210,3 +210,32 @@ function extract_messages_log ()
|
||||
--output-file ${project}/locale/${project}-log-${level}.pot
|
||||
done
|
||||
}
|
||||
|
||||
# Setup project django_openstack_auth for transifex
|
||||
function setup_django_openstack_auth ()
|
||||
{
|
||||
tx set --auto-local -r horizon.djangopo \
|
||||
"openstack_auth/locale/<lang>/LC_MESSAGES/django.po" \
|
||||
--source-lang en \
|
||||
--source-file openstack_auth/locale/openstack_auth.pot -t PO \
|
||||
--execute
|
||||
}
|
||||
|
||||
# Filter out files that we do not want to commit
|
||||
function filter_commits ()
|
||||
{
|
||||
# Don't send files where the only things which have changed are
|
||||
# the creation date, the version number, the revision date,
|
||||
# comment lines, or diff file information.
|
||||
for f in `git diff --cached --name-only`
|
||||
do
|
||||
changed=$(git diff --cached "$f" \
|
||||
| egrep -v "(POT-Creation-Date|Project-Id-Version|PO-Revision-Date)" \
|
||||
| egrep -c "^([-+][^-+#])")
|
||||
if [ $changed -eq 0 ]
|
||||
then
|
||||
git reset -q "$f"
|
||||
git checkout -- "$f"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -59,16 +59,6 @@ done
|
||||
# Add all changed files to git
|
||||
git add $PROJECT/locale/*
|
||||
|
||||
# Don't send files where the only things which have changed are the
|
||||
# creation date, the version number, the revision date, or comment
|
||||
# lines.
|
||||
for f in `git diff --cached --name-only`
|
||||
do
|
||||
if [ `git diff --cached $f |egrep -v "(POT-Creation-Date|Project-Id-Version|PO-Revision-Date|^\+{3}|^\-{3}|^[-+]#)" | egrep -c "^[\-\+]"` -eq 0 ]
|
||||
then
|
||||
git reset -q $f
|
||||
git checkout -- $f
|
||||
fi
|
||||
done
|
||||
filter_commits
|
||||
|
||||
send_patch
|
||||
|
45
modules/openstack_project/files/slave_scripts/propose_translation_update_django_openstack_auth.sh
Executable file
45
modules/openstack_project/files/slave_scripts/propose_translation_update_django_openstack_auth.sh
Executable file
@ -0,0 +1,45 @@
|
||||
#!/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.
|
||||
|
||||
ORG=openstack
|
||||
PROJECT=django_openstack_auth
|
||||
COMMIT_MSG="Imported Translations from Transifex"
|
||||
|
||||
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
|
||||
|
||||
setup_git
|
||||
|
||||
setup_review "$ORG" "$PROJECT"
|
||||
|
||||
setup_django_openstack_auth
|
||||
|
||||
# Pull upstream translations of files that are at least 75 %
|
||||
# translated
|
||||
tx pull -a -f --minimum-perc=75
|
||||
|
||||
# Update the .pot file
|
||||
python setup.py extract_messages
|
||||
PO_FILES=`find openstack_auth/locale -name '*.po'`
|
||||
if [ -n "$PO_FILES" ]
|
||||
then
|
||||
# Use updated .pot file to update translations
|
||||
python setup.py update_catalog --no-fuzzy-matching --ignore-obsolete=true
|
||||
fi
|
||||
|
||||
# Add all changed files to git
|
||||
git add openstack_auth/locale/*
|
||||
|
||||
filter_commits
|
||||
|
||||
send_patch
|
@ -34,16 +34,6 @@ tx pull -a -f --minimum-perc=75
|
||||
# Add all changed files to git
|
||||
git add horizon/locale/* openstack_dashboard/locale/*
|
||||
|
||||
# Don't send files where the only things which have changed are the
|
||||
# creation date, the version number, the revision date, or comment
|
||||
# lines.
|
||||
for f in `git diff --cached --name-only`
|
||||
do
|
||||
if [ `git diff --cached $f |egrep -v "(POT-Creation-Date|Project-Id-Version|PO-Revision-Date|^\+{3}|^\-{3}|^[-+]#)" | egrep -c "^[\-\+]"` -eq 0 ]
|
||||
then
|
||||
git reset -q $f
|
||||
git checkout -- $f
|
||||
fi
|
||||
done
|
||||
filter_commits
|
||||
|
||||
send_patch
|
||||
|
@ -52,16 +52,6 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
# Don't send files where the only things which have changed are the
|
||||
# creation date, the version number, the revision date, or comment
|
||||
# lines.
|
||||
for f in `git diff --cached --name-only`
|
||||
do
|
||||
if [ `git diff --cached $f |egrep -v "(POT-Creation-Date|Project-Id-Version|PO-Revision-Date|^\+{3}|^\-{3}|^[-+]#)" | egrep -c "^[\-\+]"` -eq 0 ]
|
||||
then
|
||||
git reset -q $f
|
||||
git checkout -- $f
|
||||
fi
|
||||
done
|
||||
filter_commits
|
||||
|
||||
send_patch
|
||||
|
41
modules/openstack_project/files/slave_scripts/upstream_translation_django_openstack_auth.sh
Executable file
41
modules/openstack_project/files/slave_scripts/upstream_translation_django_openstack_auth.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
# Copyright 2014 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
|
||||
#
|
||||
# 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.
|
||||
|
||||
# The script is to push the updated English po to Transifex.
|
||||
|
||||
if [ ! `echo $ZUUL_REFNAME | grep master` ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
|
||||
|
||||
setup_git
|
||||
setup_translation
|
||||
|
||||
setup_django_openstack_auth
|
||||
|
||||
# Update the .pot file
|
||||
python setup.py extract_messages
|
||||
|
||||
# Add all changed files to git
|
||||
git add openstack_auth/locale/*
|
||||
|
||||
if [ ! `git diff-index --quiet HEAD --` ]
|
||||
then
|
||||
# Push .pot changes to transifex
|
||||
tx --debug --traceback push -s
|
||||
fi
|
@ -1668,8 +1668,7 @@ projects:
|
||||
- name: check-requirements
|
||||
- name: integrated-gate
|
||||
- name: stable-compat-jobs
|
||||
post:
|
||||
- django_openstack_auth-upstream-translation-update
|
||||
- name: translation-jobs
|
||||
pre-release:
|
||||
- django_openstack_auth-tarball
|
||||
release:
|
||||
|
Loading…
x
Reference in New Issue
Block a user