On Tue, May 17, 2022 at 10:32:12 +0200, Andrea Bolognani wrote:
We don't want comments to be present in the potfile, unless
they're specifically aimed at translators.
To achieve this, we pass the --add-comments=TRANSLATORS: option
to xgettext. However, we also use the 'glib' preset, which
contains the --add-comments option.
This should work fine, as later options override earlier ones,
but there's a problem: until 0.60, meson would not correctly
preserve the order of options, and so whether or not the potfile
would contain comments we don't care about was entirely down to
chance.
Add a check that will make the test suite fail if unwanted
comments have been added to the potfile.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
build-aux/syntax-check.mk | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 6664763faf..b14e2e57cc 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -1503,6 +1503,17 @@ sc_po_check:
rm -f $@-1 $@-2; \
fi
+pot_file = $(top_srcdir)/po/libvirt.pot
+
+# Before 0.60, meson would sometimes pass options to xgettext in the
+# wrong order, resulting in unwanted comments showing up in the
+# potfile after it was refreshed
+sc_pot_comments:
+ @if $(GREP) -E '^#\. ' $(pot_file) | $(GREP) -Ev 'TRANSLATORS:'; then
\
+ echo "Spurious comments in $(pot_file)" 1>&1; \
+ exit 1; \
+ fi
Ewww. This doesn't feel like a systemic fix. If meson can't generate
them properly, we should make sure to call the tool properly rahter than
just check whether it's broken.