diff --git a/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml b/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml index 701f4f2df7..747cd2c6f8 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml @@ -691,7 +691,6 @@ - python-jobs - openstack-publish-jobs - pypi-jobs - - translation-jobs - project: diff --git a/modules/openstack_project/files/jenkins_job_builder/config/translation-jobs.yaml b/modules/openstack_project/files/jenkins_job_builder/config/translation-jobs.yaml index 243a253fff..94e9b9da86 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/translation-jobs.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/translation-jobs.yaml @@ -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' diff --git a/modules/openstack_project/files/slave_scripts/common_translation_update.sh b/modules/openstack_project/files/slave_scripts/common_translation_update.sh index 6b3c327435..bb5f3d8905 100644 --- a/modules/openstack_project/files/slave_scripts/common_translation_update.sh +++ b/modules/openstack_project/files/slave_scripts/common_translation_update.sh @@ -250,3 +250,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//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 +} diff --git a/modules/openstack_project/files/slave_scripts/propose_translation_update.sh b/modules/openstack_project/files/slave_scripts/propose_translation_update.sh index 0620d690da..1c33c54712 100755 --- a/modules/openstack_project/files/slave_scripts/propose_translation_update.sh +++ b/modules/openstack_project/files/slave_scripts/propose_translation_update.sh @@ -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 diff --git a/modules/openstack_project/files/slave_scripts/propose_translation_update_django_openstack_auth.sh b/modules/openstack_project/files/slave_scripts/propose_translation_update_django_openstack_auth.sh new file mode 100755 index 0000000000..b883b09d3f --- /dev/null +++ b/modules/openstack_project/files/slave_scripts/propose_translation_update_django_openstack_auth.sh @@ -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 diff --git a/modules/openstack_project/files/slave_scripts/propose_translation_update_horizon.sh b/modules/openstack_project/files/slave_scripts/propose_translation_update_horizon.sh index 74477b381e..d2f8c51856 100755 --- a/modules/openstack_project/files/slave_scripts/propose_translation_update_horizon.sh +++ b/modules/openstack_project/files/slave_scripts/propose_translation_update_horizon.sh @@ -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 diff --git a/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh b/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh index cfa4a36063..008e572edd 100755 --- a/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh +++ b/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh @@ -43,16 +43,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 diff --git a/modules/openstack_project/files/slave_scripts/upstream_translation_django_openstack_auth.sh b/modules/openstack_project/files/slave_scripts/upstream_translation_django_openstack_auth.sh new file mode 100755 index 0000000000..79b19dad92 --- /dev/null +++ b/modules/openstack_project/files/slave_scripts/upstream_translation_django_openstack_auth.sh @@ -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 diff --git a/modules/openstack_project/files/zuul/layout.yaml b/modules/openstack_project/files/zuul/layout.yaml index f2d8bcfdf9..487f0f5bd6 100644 --- a/modules/openstack_project/files/zuul/layout.yaml +++ b/modules/openstack_project/files/zuul/layout.yaml @@ -1651,8 +1651,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: