@ -8,6 +8,13 @@
#
# Use --cleanup as an argument to clean things up.
# The files that are translated; should match the contents of .tx/config
TX_FILE_LIST = "lang/calamares_en.ts lang/python.pot src/modules/dummypythonqt/lang/dummypythonqt.pot calamares.desktop"
### COMMAND ARGUMENTS
#
# We need to define tx_cleanup for the --cleanup argument, although it's
# normally used much later in the script.
tx_cleanup( )
{
# Cleanup artifacs of checking
@ -22,6 +29,21 @@ if test "x$1" = "x--cleanup" ; then
fi
test -z " $1 " || { echo "! Usage: txcheck.sh [--cleanup]" ; exit 1 ; }
### FIND EXECUTABLES
#
#
XMLLINT = ""
for _xmllint in xmllint
do
$_xmllint --version > /dev/null 2>& 1 && XMLLINT = $_xmllint
test -n " $XMLLINT " && break
done
### CHECK WORKING DIRECTORY
#
#
if git describe translation > /dev/null 2>& 1 ; then
:
else
@ -42,8 +64,6 @@ test "$DATE_PREV" -le "$DATE_HEAD" || { echo "! Translation tag has not aged eno
# Tag is good, do real work of checking strings: collect names of relevant files
test -f ".tx/config" || { echo "! No Transifex configuration is present." ; exit 1 ; }
# Print part after = for each source_file line and delete all the rest
TX_FILE_LIST = $( sed -e '/^source_file/s+.*=++p' -e d .tx/config )
for f in $TX_FILE_LIST ; do
test -f $f || { echo " ! Translation file ' $f ' does not exist. " ; exit 1 ; }
done
@ -56,14 +76,24 @@ tx_sum()
git worktree add $WORKTREE_NAME $WORKTREE_TAG > /dev/null 2>& 1 || { echo "! Could not create worktree." ; exit 1 ; }
( cd $WORKTREE_NAME && sh ci/txpush.sh --no-tx ) > /dev/null 2>& 1 || { echo "! Could not re-create translations." ; exit 1 ; }
( cd $WORKTREE_NAME && sed -i'' -e '/<location filename/d' $TX_FILE_LIST )
# Clean up the TS (XML) files (like txpush would)
TS_FILE = " $WORKTREE_NAME /lang/calamares_en.ts "
if test -n " $XMLLINT " ; then
$XMLLINT --format -o " $TS_FILE " .new " $TS_FILE " && mv " $TS_FILE " .new " $TS_FILE "
fi
sed -i'' -e '/<location filename/d' $TS_FILE
# Remove linenumbers from .pot
sed -i'' -e '/^#: src..*[0-9]$/d' $WORKTREE_NAME /lang/python.pot $WORKTREE_NAME /src/modules/dummypythonqt/lang/dummypythonqt.pot
_SUM = $( cd $WORKTREE_NAME && cat $TX_FILE_LIST | sha256sum )
echo " $_SUM "
}
# Check from the translation tag as well
HEAD_SUM = ` tx_sum build-txcheck-head "" `
PREV_SUM = ` tx_sum build-txcheck-prev translation`
HEAD_SUM = ` tx_sum build-txcheck-head "" ` || { echo " $HEAD_SUM " ; exit 1 ; }
PREV_SUM = ` tx_sum build-txcheck-prev translation` || { echo " $HEAD_SUM " ; exit 1 ; }
echp " $? "
# An error message will have come from the shell function
test -d build-txcheck-head || { echo " $HEAD_SUM " ; exit 1 ; }
@ -80,6 +110,6 @@ else
exit 1
fi
tx_cleanup
# tx_cleanup
exit 0