1
0
mirror of https://gitlab.gnome.org/GNOME/nautilus synced 2024-06-30 23:46:35 +00:00

ci: Add script to check for potfile errors

It's easy to forget to update potfiles. Steal the script that
gnome-shell uses to check for this.
This commit is contained in:
Corey Berla 2024-01-30 13:45:56 -08:00
parent 867d3fc153
commit 1234b5ad66
2 changed files with 45 additions and 0 deletions

View File

@ -5,6 +5,7 @@ variables:
stages:
- image
- review
- test
- analyze
- deploy
@ -43,6 +44,12 @@ nightly@aarch64:
extends: '.publish_nightly'
needs: ['flatpak@aarch64']
potfile:
image: registry.gitlab.gnome.org/gnome/nautilus:latest
stage: review
script:
- data/check-potfiles.sh
style check:
image: registry.gitlab.gnome.org/gnome/nautilus:latest
stage: test

38
data/check-potfiles.sh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
srcdirs="eel extensions src libnautilus-extension"
uidirs="src/resources/ui src/gtk"
desktopdirs="data"
# find source files that contain gettext keywords
files=$(grep -lR --include='*.c' '\(gettext\|[^I_)]_\)(' $srcdirs)
# find ui files that contain translatable string
files="$files "$(grep -lRi --include='*.ui' 'translatable="[ty1]' $uidirs)
# find .desktop files
files="$files "$(find $desktopdirs -name '*.desktop*')
# filter out excluded files
if [ -f po/POTFILES.skip ]; then
files=$(for f in $files; do ! grep -q ^$f po/POTFILES.skip && echo $f; done)
fi
# find those that aren't listed in POTFILES.in
missing=$(for f in $files; do ! grep -q ^$f po/POTFILES.in && echo $f; done)
if [ ${#missing} -eq 0 ]; then
exit 0
fi
cat >&2 <<EOT
The following files are missing from po/POTFILES.po:
EOT
for f in $missing; do
echo " $f" >&2
done
echo >&2
exit 1