| 1 | #!/bin/sh |
| 2 | # Copyright (C) 2016 Red Hat, Inc. |
| 3 | # |
| 4 | # This copyrighted material is made available to anyone wishing to use, |
| 5 | # modify, copy, or redistribute it subject to the terms and conditions of |
| 6 | # the GNU Lesser General Public License v.2, or (at your option) any later |
| 7 | # version. This program is distributed in the hope that it will be useful, |
| 8 | # but WITHOUT ANY WARRANTY expressed or implied, including the implied |
| 9 | # warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 10 | # the GNU Lesser General Public License for more details. You should have |
| 11 | # received a copy of the GNU Lesser General Public License along with this |
| 12 | # program; if not, write to the Free Software Foundation, Inc., 51 Franklin |
| 13 | # Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks |
| 14 | # that are incorporated in the source code or documentation are not subject |
| 15 | # to the GNU Lesser General Public License and may only be used or |
| 16 | # replicated with the express permission of Red Hat, Inc. |
| 17 | # |
| 18 | # Red Hat Author(s): David Shea <[email protected]> |
| 19 | |
| 20 | # Test a project's .po files |
| 21 | |
| 22 | if [ $# -ne 1 ]; then |
| 23 | echo "Usage: test_projects.sh <project-list-file>" |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | status=0 |
| 28 | while read -r project_name l10n_git ; do |
| 29 | echo "Testing $project_name" |
| 30 | |
| 31 | podir="$(mktemp -d "${project_name}".XXXXXX)" |
| 32 | |
| 33 | # Download translations |
| 34 | git clone --depth 1 -- "$l10n_git" "$podir" |
| 35 | |
| 36 | # Ignore the percent-translated warnings |
| 37 | if ! python3 -W ignore -m translation_canary.translated "$podir"; then |
| 38 | echo "Canary test failed for $project_name" |
| 39 | status=1 |
| 40 | else |
| 41 | echo "Success: $project_name" |
| 42 | fi |
| 43 | |
| 44 | rm -rf "$podir" |
| 45 | done < "$1" |
| 46 | |
| 47 | exit "$status" |