|
Packit Service |
af52df |
#!/bin/sh -e
|
|
Packit Service |
af52df |
#
|
|
Packit Service |
af52df |
# xgettext_werror.sh: Run xgettext and actually do something with the warnings
|
|
Packit Service |
af52df |
#
|
|
Packit Service |
af52df |
# xgettext prints out warnings for certain problems in translatable strings,
|
|
Packit Service |
af52df |
# such as format strings that cannot be translated due to position-based
|
|
Packit Service |
af52df |
# parameters. These warnings generally indicate something that needs to be
|
|
Packit Service |
af52df |
# addressed before the strings can be submitted for translation. This script
|
|
Packit Service |
af52df |
# exits with a status of 1 so that the warnings are not ignored as they scroll
|
|
Packit Service |
af52df |
# by in pages of build output.
|
|
Packit Service |
af52df |
#
|
|
Packit Service |
af52df |
# This script should be used in place of xgettext when rebuilding the .pot file,
|
|
Packit Service |
af52df |
# e.g. by setting XGETTEXT in po/Makevars.
|
|
Packit Service |
af52df |
#
|
|
Packit Service |
af52df |
# Copyright (C) 2015 Red Hat, Inc.
|
|
Packit Service |
af52df |
#
|
|
Packit Service |
af52df |
# This copyrighted material is made available to anyone wishing to use,
|
|
Packit Service |
af52df |
# modify, copy, or redistribute it subject to the terms and conditions of
|
|
Packit Service |
af52df |
# the GNU Lesser General Public License v.2, or (at your option) any later
|
|
Packit Service |
af52df |
# version. This program is distributed in the hope that it will be useful,
|
|
Packit Service |
af52df |
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
|
|
Packit Service |
af52df |
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
Packit Service |
af52df |
# the GNU Lesser General Public License for more details. You should have
|
|
Packit Service |
af52df |
# received a copy of the GNU Lesser General Public License along with this
|
|
Packit Service |
af52df |
# program; if not, write to the Free Software Foundation, Inc., 51 Franklin
|
|
Packit Service |
af52df |
# Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks
|
|
Packit Service |
af52df |
# that are incorporated in the source code or documentation are not subject
|
|
Packit Service |
af52df |
# to the GNU Lesser General Public License and may only be used or
|
|
Packit Service |
af52df |
# replicated with the express permission of Red Hat, Inc.
|
|
Packit Service |
af52df |
#
|
|
Packit Service |
af52df |
# Red Hat Author(s): David Shea <dshea@redhat.com>
|
|
Packit Service |
af52df |
|
|
Packit Service |
af52df |
returncode=0
|
|
Packit Service |
af52df |
|
|
Packit Service |
af52df |
# Collect the output from xgettext. If xgettext fails, treat that as a failure
|
|
Packit Service |
af52df |
# Make sure that "warning:" doesn't get translated
|
|
Packit Service |
af52df |
xgettext_output="$(LC_MESSAGES=C xgettext "$@" 2>&1)" || returncode=$?
|
|
Packit Service |
af52df |
|
|
Packit Service |
af52df |
# Look for warnings
|
|
Packit Service |
af52df |
if echo "$xgettext_output" | fgrep -q "warning: "; then
|
|
Packit Service |
af52df |
returncode=1
|
|
Packit Service |
af52df |
fi
|
|
Packit Service |
af52df |
|
|
Packit Service |
af52df |
# Print the output and return
|
|
Packit Service |
af52df |
echo "$xgettext_output"
|
|
Packit Service |
af52df |
exit $returncode
|