diff --git a/ci/txcheck.sh b/ci/txcheck.sh index a2130c9d5..61fdd7030 100644 --- a/ci/txcheck.sh +++ b/ci/txcheck.sh @@ -1,5 +1,18 @@ #! /bin/sh +### LICENSE +# === This file is part of Calamares - === +# +# This file is Free Software: you can redistribute it and/or modify +# it under the terms of the 2-clause BSD License. +# https://spdx.org/licenses/BSD-2-Clause.html +# +# SPDX-License-Identifier: BSD-2-Clause +# SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot +### END LICENSE + +### USAGE +# # Does the translation tag (from a previous txpush) exist? # This assumes that the release host has also locally done # a translations push, which works for the current development @@ -7,6 +20,13 @@ # the typical txpush log messages instead of the tag. # # Use --cleanup as an argument to clean things up. +# +# Normal use: +# $ sh ci/txcheck.sh +# If there are differences, fix them and then clean up: +# $ sh ci/txcheck.sh --cleanup +# +### END USAGE # 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" @@ -27,6 +47,9 @@ if test "x$1" = "x--cleanup" ; then tx_cleanup exit 0 fi +if test "x$1" = "x--help" ; then + sed -e '1,/USAGE/d' -e '/END.USAGE/,$d' < "$0" +fi test -z "$1" || { echo "! Usage: txcheck.sh [--cleanup]" ; exit 1 ; } @@ -67,6 +90,8 @@ fi if test `git describe` = `git describe --dirty` ; then : else + # Don't want any local changes, since those won't be + # reflected in the worktrees and we might miss a string change. echo "! There are local changes." exit 1 fi @@ -75,13 +100,20 @@ DATE_PREV=$( git log -1 translation --date=unix | sed -e '/^Date:/s+.*:++p' -e d DATE_HEAD=$( last_week ) test "$DATE_PREV" -le "$DATE_HEAD" || { echo "! Translation tag has not aged enough." ; git log -1 translation ; exit 1 ; } -# Tag is good, do real work of checking strings: collect names of relevant files +# Tag is good, check that necessary files exist. The list of +# files is hard-coded, but should match what is in the Transifex config. test -f ".tx/config" || { echo "! No Transifex configuration is present." ; exit 1 ; } for f in $TX_FILE_LIST ; do test -f $f || { echo "! Translation file '$f' does not exist." ; exit 1 ; } done -# The state of translations +### COMPARE TRANSLATIONS +# +# + +# The state of translations; assume that sha256 is enough +# to distinguish changed translations when we cat all the +# string sources together. tx_sum() { CURDIR=`pwd`