intl/tst-gettext: fix failure with newest msgfmt
Commit Message
Since upstream gettext commit d13f165b83 (msgfmt: Remove
POT-Creation-Date field from the header in the output.), msgfmt does not
copy the POT-Creation-Date field in the header entry from the po file to
the mo file anymore. This breaks the assumption that we can test gettext
by comparing each message in the po files with the corresponding string
return by gettext. This makes the intl/tst-gettext to fail.
While it would have been possible to modify the po2test.awk script to
also strip the line POT-Creation-Date field when creating the msgs.h
file, it breaks tst-catgets which also uses it.
Instead create a tst-gettext-de.po file from de.po by removing the
POT-Creation-Date line. Another alternative would be to use a static
tst-gettext-de.po file, but I guess the reason for using de.po is to
also catch issues caused by newly added strings.
Changelog:
[BZ #21508]
* catgets/Makefile ($(objpfx)de.msg): Depend on
$(common-objpfx)intl/tst-gettext-de.po instead of $(..)po/de.po.
* intl/Makefile ($(objpfx)tst-gettext-de.po): Generate
intl/tst-gettext-de.po from po/de.po by removing the
POT-Creation-Date line.
($(objpfx)msgs.h): Depend on $(objpfx)tst-gettext-de.po instead of
../po/de.po.
* intl/tst-gettext.sh: Use ${objpfx}tst-gettext-de.po instead of
../po/de.po.
---
ChangeLog | 13 +++++++++++++
catgets/Makefile | 2 +-
intl/Makefile | 6 +++++-
intl/tst-gettext.sh | 4 ++--
4 files changed, 21 insertions(+), 4 deletions(-)
Comments
On 26/08/17 09:57, Aurelien Jarno wrote:
> Since upstream gettext commit d13f165b83 (msgfmt: Remove
> POT-Creation-Date field from the header in the output.), msgfmt does not
> copy the POT-Creation-Date field in the header entry from the po file to
> the mo file anymore. This breaks the assumption that we can test gettext
> by comparing each message in the po files with the corresponding string
> return by gettext. This makes the intl/tst-gettext to fail.
>
> While it would have been possible to modify the po2test.awk script to
> also strip the line POT-Creation-Date field when creating the msgs.h
> file, it breaks tst-catgets which also uses it.
>
> Instead create a tst-gettext-de.po file from de.po by removing the
> POT-Creation-Date line. Another alternative would be to use a static
> tst-gettext-de.po file, but I guess the reason for using de.po is to
> also catch issues caused by newly added strings.
>
i updated msgfmt on my system and now i get
FAIL: intl/tst-gettext
because of this issue
https://savannah.gnu.org/bugs/?49654
the fix looks reasonable to me.
> Changelog:
> [BZ #21508]
> * catgets/Makefile ($(objpfx)de.msg): Depend on
> $(common-objpfx)intl/tst-gettext-de.po instead of $(..)po/de.po.
> * intl/Makefile ($(objpfx)tst-gettext-de.po): Generate
> intl/tst-gettext-de.po from po/de.po by removing the
> POT-Creation-Date line.
> ($(objpfx)msgs.h): Depend on $(objpfx)tst-gettext-de.po instead of
> ../po/de.po.
> * intl/tst-gettext.sh: Use ${objpfx}tst-gettext-de.po instead of
> ../po/de.po.
@@ -1,3 +1,16 @@
+2017-08-26 Aurelien Jarno <aurelien@aurel32.net>
+
+ [BZ #21508]
+ * catgets/Makefile ($(objpfx)de.msg): Depend on
+ $(common-objpfx)intl/tst-gettext-de.po instead of $(..)po/de.po.
+ * intl/Makefile ($(objpfx)tst-gettext-de.po): Generate
+ intl/tst-gettext-de.po from po/de.po by removing the
+ POT-Creation-Date line.
+ ($(objpfx)msgs.h): Depend on $(objpfx)tst-gettext-de.po instead of
+ ../po/de.po.
+ * intl/tst-gettext.sh: Use ${objpfx}tst-gettext-de.po instead of
+ ../po/de.po.
+
2017-08-25 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86/cpu-features.h [__ASSEMBLER__]
@@ -78,7 +78,7 @@ $(objpfx)de/libc.cat: $(objpfx)de.msg $(objpfx)gencat
$(objpfx)tst-catgets.out: $(objpfx)de/libc.cat
# Generate a non-simple input file.
-$(objpfx)de.msg: xopen-msg.awk $(..)po/de.po
+$(objpfx)de.msg: xopen-msg.awk $(common-objpfx)intl/tst-gettext-de.po
LC_ALL=C $(AWK) -f $^ $< > $@
$(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
@@ -120,7 +120,11 @@ $(objpfx)tst-gettext6.out: $(gen-locales)
$(objpfx)tst-translit.out: $(gen-locales)
endif
-$(objpfx)msgs.h: po2test.awk ../po/de.po
+$(objpfx)tst-gettext-de.po: ../po/de.po
+ $(make-target-directory)
+ LC_ALL=C $(AWK) '!/^"POT-Creation-Date: [0-9-]+ [0-9:+-]+\\n"$$/' $^ > $@
+
+$(objpfx)msgs.h: po2test.awk $(objpfx)tst-gettext-de.po
$(make-target-directory)
LC_ALL=C $(AWK) -f $^ > $@
@@ -42,9 +42,9 @@ mkdir -p ${objpfx}domaindir/existing-locale/LC_MESSAGES
mkdir -p ${objpfx}domaindir/existing-locale/LC_TIME
# Populate them.
msgfmt -o ${objpfx}domaindir/existing-locale/LC_MESSAGES/existing-domain.mo \
- -f ../po/de.po
+ -f ${objpfx}tst-gettext-de.po
msgfmt -o ${objpfx}domaindir/existing-locale/LC_TIME/existing-time-domain.mo \
- -f ../po/de.po
+ -f ${objpfx}tst-gettext-de.po
# Now run the test.
${test_program_prefix_before_env} \