diff options
author | Fedja Beader <fedja@protonmail.ch> | 2025-02-24 22:37:18 +0000 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2025-02-24 22:37:18 +0000 |
commit | 9588ba1f4a58078440101005285f6daae126465b (patch) | |
tree | 27d6a4fab9f70ccf4464ef08241d452dcaaff342 | |
parent | 1a0a23243c408e056a439bd5ee7cb5491b5348d8 (diff) | |
download | manaplus-9588ba1f4a58078440101005285f6daae126465b.tar.gz manaplus-9588ba1f4a58078440101005285f6daae126465b.tar.bz2 manaplus-9588ba1f4a58078440101005285f6daae126465b.tar.xz manaplus-9588ba1f4a58078440101005285f6daae126465b.zip |
Add POTFILES.in updater check to linter CI job.
while processing mana/plus!132 I spotted what looked like an ommision of several
src/progs/{manaplus,manaverse} files from POTFILES.in, but as it turned
out, they have no strings marked for translation (start with "_(").
Squashed with:
* Just force LC_COLLATE=C and commit POTFILES.in changes required to make
this happen. Don't know how to repro CI's sorting locally and it's
pointless as my local sort is clearly wrong. See traderecv.cpp's position
for why.
* The correct locale variable to set should be LC_COLLATE, which is
probably set by LANG on all platforms and so this will fail, again.
* sort is still not preserving the order of files :/
* Ensure the order of files remains the same regardless of platform.
* POTFILES update to pass CI :)
****
mana/plus!133
-rw-r--r-- | .gitlab-ci.yml | 1 | ||||
-rw-r--r-- | po/POTFILES.in | 7 | ||||
-rwxr-xr-x | po/POTgen.sh | 25 | ||||
-rwxr-xr-x | tools/ci/jobs/potfiles_update_check.sh | 21 |
4 files changed, 49 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c266c1c16..48cf745b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -361,6 +361,7 @@ linters: - ./tools/ci/jobs/imagemagiccheck.sh - ./tools/ci/jobs/cpplint.sh - ./tools/ci/jobs/nsiqcppstyle.sh + - ./tools/ci/jobs/potfiles_update_check.sh <<: *job-push variables: MPLINT_PACKAGE_URL: "$CI_API_V4_URL/projects/mana%2Fmplint/jobs/artifacts/master/download?job=package_debian10_buster" diff --git a/po/POTFILES.in b/po/POTFILES.in index 641a0e5d5..ab55fb4fe 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,3 +1,4 @@ +# Generated by ./po/POTgen.sh, do not edit manually src/actormanager.cpp src/being/being.cpp src/being/localplayer.cpp @@ -65,8 +66,8 @@ src/gui/widgets/tabs/setup_video.cpp src/gui/widgets/tabs/setup_visual.cpp src/gui/widgets/tabs/socialattacktab.h src/gui/widgets/tabs/socialfriendstab.h -src/gui/widgets/tabs/socialguildtab2.h src/gui/widgets/tabs/socialguildtab.h +src/gui/widgets/tabs/socialguildtab2.h src/gui/widgets/tabs/socialnavigationtab.h src/gui/widgets/tabs/socialpartytab.h src/gui/widgets/tabs/socialpickuptab.h @@ -146,6 +147,7 @@ src/net/ea/chatrecv.cpp src/net/ea/gamerecv.cpp src/net/ea/loginrecv.cpp src/net/ea/network.cpp +src/net/ea/traderecv.cpp src/net/eathena/charserverrecv.cpp src/net/eathena/chatrecv.cpp src/net/eathena/familyrecv.cpp @@ -161,7 +163,6 @@ src/net/eathena/maptypeproperty2.h src/net/eathena/playerrecv.cpp src/net/eathena/skillrecv.cpp src/net/eathena/vendingrecv.cpp -src/net/ea/traderecv.cpp src/net/tmwa/charserverhandler.cpp src/net/tmwa/charserverrecv.cpp src/net/tmwa/chatrecv.cpp @@ -179,8 +180,8 @@ src/progs/manaplus/actions/pets.cpp src/progs/manaplus/actions/statusbar.cpp src/progs/manaplus/actions/windows.cpp src/progs/manaplus/client.cpp -src/render/rendererslistsdl2.h src/render/rendererslistsdl.h +src/render/rendererslistsdl2.h src/resources/beinginfo.cpp src/resources/db/avatardb.cpp src/resources/db/clandb.cpp diff --git a/po/POTgen.sh b/po/POTgen.sh index 15fc85677..a2b1ad31c 100755 --- a/po/POTgen.sh +++ b/po/POTgen.sh @@ -1,4 +1,25 @@ #!/bin/bash +# This program is run by a CI job -cd .. -grep "_(" -Irl src | sort >po/POTFILES.in +if [[ ! -d po || ! -d src ]]; then + printf "Please run this in top level directory" + exit 1 +fi + +printf "# Generated by %s, do not edit manually\n" "$0" > po/POTFILES.in + +#printf "Environment LANG is '%s'\n" "$(env | grep '^LANG=')" +#printf "Environment LC_COLLATE is '%s'\n" "$(env | grep '^LC_COLLATE=')" +#if command -v locale >/dev/null; then +# printf "locale LC_COLLATE is '%s'\n" "$(locale | grep '^LC_COLLATE=')" +#fi + +# See WARNING in manpage of GNU Coreutils sort: +# LC_COLLATE override is required to preserve the order of files +# across platforms. But it can be override by LC_ALL. +# But, LC_ALL should never be set in a sane environment. +grep "_(" src \ + --binary-files=without-match \ + --files-with-matches \ + --recursive \ + | LC_COLLATE="C" sort >> po/POTFILES.in diff --git a/tools/ci/jobs/potfiles_update_check.sh b/tools/ci/jobs/potfiles_update_check.sh new file mode 100755 index 000000000..6610d4332 --- /dev/null +++ b/tools/ci/jobs/potfiles_update_check.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e # Fail if any command fails +set -u # Fail if any variable is unset when used + +export LOGFILE=potfiles.log +source ./tools/ci/scripts/init.sh + +./po/POTgen.sh + +# error if POTgen applied any changes +git diff >> "$ERRFILE" + +# Save in-progress work in case someone runs this script manually. +#git stash push -m "POTgen run" +# Restore repository back to original state for other ci jobs. +#git reset --hard + +run_check_warnings + +echo ok |