3 # Copyright (C) 2014 VA Linux Systems Japan K.K.
4 # Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
7 # Licensed under the Apache License, Version 2.0 (the "License"); you may
8 # not use this file except in compliance with the License. You may obtain
9 # a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 # License for the specific language governing permissions and limitations
19 TMPDIR=`mktemp -d /tmp/${0##*/}.XXXXXX` || exit 1
21 trap "rm -rf $TMPDIR" EXIT
23 FAILURES=$TMPDIR/failures
26 check_no_symlinks_allowed () {
27 # Symlinks break the package build process, so ensure that they
28 # do not slip in, except hidden symlinks.
29 if [ $(find . -type l ! -path '*/.*' | wc -l) -ge 1 ]; then
30 echo "Symlinks are not allowed!" >>$FAILURES
35 check_pot_files_errors () {
36 # The job neutron-propose-translation-update does not update from
37 # transifex since our po files contain duplicate entries where
38 # obsolete entries duplicate normal entries. Prevent obsolete
40 find neutron -type f -regex '.*\.pot?' \
41 -print0|xargs -0 -n 1 msgfmt --check-format \
43 if [ "$?" -ne 0 ]; then
44 echo "PO files syntax is not correct!" >>$FAILURES
49 check_identical_policy_files () {
50 # For unit tests, we maintain their own policy.json file to make test suite
51 # independent of whether it's executed from the neutron source tree or from
52 # site-packages installation path. We don't want two copies of the same
53 # file to diverge, so checking that they are identical
54 diff etc/policy.json neutron/tests/etc/policy.json 2>&1 > /dev/null
55 if [ "$?" -ne 0 ]; then
56 echo "policy.json files must be identical!" >>$FAILURES
60 # Add your checks here...
61 check_no_symlinks_allowed
62 check_pot_files_errors
63 check_identical_policy_files
65 # Fail, if there are emitted failures
66 if [ -f $FAILURES ]; then