Add a check if a proposed team member list is current

It is a boring job to review a patch to update the team member list.
To avoid this, this commit proposes a bit improved approach.

- When you want to propose an update of the team member list,
  you need to sync all members with Zanata.
  If you want to add you, you need to propose a latest member list.
  The new list may contains someone other than you.
- pep8 job checks a proposed member list is up-to-date.
  If not, the job fails.

To make it easy to sync all members with Zanata, a tox target
'zanata-users-sync' is added. To download the latest member list
of all language teams, just run:

  tox -e zanata-users-sync

Change-Id: I393a6b77261f6a3d7788a4c4f57bd6fdc95b5146
This commit is contained in:
Akihiro Motoki 2017-07-27 23:19:54 +00:00 committed by Ian Y. Choi
parent ea92d22802
commit c1dc203aba
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#!/bin/bash
set -ex
TEAM_LIST=tools/zanata/translation_team.yaml
# This is to detect the change of the team list location.
# It is just a safe guard.
if [ ! -f $TEAM_LIST ]; then
echo "$TEAM_LIST not found. Something wrong."
exit 1
fi
if ! git diff --name-only HEAD^ | grep -q $TEAM_LIST; then
echo "The recent commit does not touch $TEAM_LIST, so skipping the check."
exit 0
fi
TMPFILE=`mktemp`
trap "rm -f $TMPFILE" EXIT
python tools/zanata/zanata_users.py --output-file $TMPFILE
if ! diff -u $TEAM_LIST $TMPFILE; then
set -x
cat <<EOF
The proposed $TEAM_LIST does not match the current Zanata team member list.
Consider reproposing it after syncing it with Zanata.
To do so, run 'tox -e zanata-users-sync'.
EOF
set +x
exit 1
fi

View File

@ -35,8 +35,13 @@ commands =
flake8
bash -c "find {toxinidir} -type f \( -name '*.po' -o -name '*.pot' \) -print0 | xargs -0 -n1 --no-run-if-empty msgfmt --check-format -o /dev/null"
python {toxinidir}/tools/check_yaml_file.py {toxinidir}/tools/zanata/translation_team.yaml
bash {toxinidir}/tools/check-zanata-users-list.sh
whitelist_externals = bash
[testenv:generatepot]
# Generate POT files for translation
commands = {toxinidir}/tools/generatepot.sh
[testenv:zanata-users-sync]
commands =
python {toxinidir}/tools/zanata/zanata_users.py --output-file {toxinidir}/tools/zanata/translation_team.yaml