From eca5567f1cea67ac86556ef3d4a4fa7402dfb891 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Aug 20 2019 11:48:11 +0000 Subject: Fix misbehavior of msgmerge --for-msgfmt This fixes build errors in packages with empty .po files: https://gitlab.gnome.org/GNOME/gcr/issues/25 https://github.com/p11-glue/p11-kit/issues/238 --- diff --git a/gettext-msgmerge-for-msgfmt.patch b/gettext-msgmerge-for-msgfmt.patch new file mode 100644 index 0000000..ba85080 --- /dev/null +++ b/gettext-msgmerge-for-msgfmt.patch @@ -0,0 +1,82 @@ +From 2336451ed68d91ff4b5ae1acbc1eca30e47a86a9 Mon Sep 17 00:00:00 2001 +From: Bruno Haible +Date: Sun, 19 May 2019 13:10:06 +0200 +Subject: [PATCH] msgmerge: Fix behaviour of --for-msgfmt on PO files with no + translations. + +Reported by Don Lawrence +in +via Daiki Ueno +in . + +* gettext-tools/src/msgmerge.c (main): Treat force_po like true if for_msgfmt +is true. +* gettext-tools/tests/msgmerge-26: Add test of PO file with no translations. +--- + gettext-tools/src/msgmerge.c | 4 ++-- + gettext-tools/tests/msgmerge-26 | 36 ++++++++++++++++++++++++++++++--- + 2 files changed, 35 insertions(+), 5 deletions(-) + +diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c +index cd762c029..92c9b7a8e 100644 +--- a/gettext-tools/src/msgmerge.c ++++ b/gettext-tools/src/msgmerge.c +@@ -520,8 +520,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\ + else + { + /* Write the merged message list out. */ +- msgdomain_list_print (result, output_file, output_syntax, force_po, +- false); ++ msgdomain_list_print (result, output_file, output_syntax, ++ for_msgfmt || force_po, false); + } + + exit (EXIT_SUCCESS); +diff --git a/gettext-tools/tests/msgmerge-26 b/gettext-tools/tests/msgmerge-26 +index cd3862e33..b86f7a073 100755 +--- a/gettext-tools/tests/msgmerge-26 ++++ b/gettext-tools/tests/msgmerge-26 +@@ -73,7 +73,37 @@ msgstr "Papaya" + EOF + + : ${DIFF=diff} +-${DIFF} mm-test26.ok mm-test26.out +-result=$? ++${DIFF} mm-test26.ok mm-test26.out || Exit 1 + +-exit $result ++# Test with a PO file that has no translated messages. ++ ++cat <<\EOF > mm-test26a.in1 ++msgid "" ++msgstr "" ++"Content-Type: text/plain; charset=UTF-8\n" ++ ++msgid "Hello world" ++msgstr "Hallo Welt" ++EOF ++ ++cat <<\EOF > mm-test26a.in2 ++msgid "" ++msgstr "" ++"Content-Type: text/plain; charset=ASCII\n" ++ ++msgid "Hello, world!" ++msgstr "" ++EOF ++ ++: ${MSGMERGE=msgmerge} ++${MSGMERGE} --for-msgfmt -o mm-test26a.tmp mm-test26a.in1 mm-test26a.in2 \ ++ || Exit 1 ++LC_ALL=C tr -d '\r' < mm-test26a.tmp > mm-test26a.out || Exit 1 ++ ++cat <<\EOF > mm-test26a.ok ++msgid "" ++msgstr "Content-Type: text/plain; charset=UTF-8\n" ++EOF ++ ++: ${DIFF=diff} ++${DIFF} mm-test26a.ok mm-test26a.out || Exit 1 +-- +2.21.0 + diff --git a/gettext.spec b/gettext.spec index e277a7e..6450437 100644 --- a/gettext.spec +++ b/gettext.spec @@ -7,7 +7,7 @@ Summary: GNU libraries and utilities for producing multi-lingual messages Name: gettext Version: %{tarversion} -Release: 1%{?dist} +Release: 2%{?dist} # The following are licensed under LGPLv2+: # - libintl and its headers # - libasprintf and its headers @@ -27,6 +27,8 @@ Source: https://ftp.gnu.org/pub/gnu/gettext/%{name}-%{version}.tar.xz Source2: msghack.py Source3: msghack.1 +Patch1: gettext-msgmerge-for-msgfmt.patch + # for bootstrapping # BuildRequires: autoconf >= 2.62 # BuildRequires: automake @@ -394,6 +396,9 @@ make check LIBUNISTRING=-lunistring %{_mandir}/man1/msghack.1* %changelog +* Tue Aug 20 2019 Daiki Ueno - 0.20.1-2 +- Fix misbehavior of msgmerge --for-msgfmt + * Fri Aug 9 2019 Jerry James - 0.20.1-1 - update to 0.20.1 release, all patches upstreamed - add GFDL to License fields due to info files