diff -ru pkgbinarymangler-136.orig/debian/changelog pkgbinarymangler-136/debian/changelog --- pkgbinarymangler-136.orig/debian/changelog 2018-04-09 18:23:47.000000000 +0200 +++ pkgbinarymangler-136/debian/changelog 2018-04-12 19:44:07.612499960 +0200 @@ -1,3 +1,14 @@ +pkgbinarymangler (137) bionic; urgency=medium + + * dh_translations: + - Prevent domain confusion for Meson packages when a 'help-' domain + is present (LP: #1762889). + - Allow the domain to be passed to dh_translations via an option in + debian/rules. + - Strip also Icon and Keywords translations in .desktop files. + + -- Gunnar Hjalmarsson Thu, 12 Apr 2018 19:44:00 +0200 + pkgbinarymangler (136) bionic; urgency=medium * dh_translations: Add support for meson / ninja projects. (LP: #1751820) diff -ru pkgbinarymangler-136.orig/dh_translations pkgbinarymangler-136/dh_translations --- pkgbinarymangler-136.orig/dh_translations 2018-04-09 11:20:18.000000000 +0200 +++ pkgbinarymangler-136/dh_translations 2018-04-12 18:57:49.657027151 +0200 @@ -36,6 +36,19 @@ =back +=head1 OPTIONS + +=over 4 + +=item B<--domain=>I + +dh_translations usually figures out the gettext domain automatically. +However, for some packages with the Meson build system the program fails +to unambiguously determine the domain. In those cases the correct domain +can be passed to the program through this option. + +=back + =cut my ($domain, $use_intltool, $meson_builddir); @@ -111,16 +124,29 @@ my $all_domains = qx_cmd ("meson introspect '$meson_builddir' --targets | jq -r -M '.[].name | select(endswith(\"-pot\")) | sub(\"-pot\"; \"\")'"); - my @domains = split ('\n', $all_domains); + my %domains = map { $_ => 1 } split ' ', $all_domains; - if ($#domains >= 1) { - warning "more than one meson translation domain found (" . join (",", @domains) . "), don't know which one to use"; - return; + # use domain passed as option at first hand + if ($dh{DOMAIN}) { + if ($domains{ $dh{DOMAIN} }) { + $domain = $dh{DOMAIN}; + return; + } else { + warning "ignoring unknown domain $dh{DOMAIN} which was passed as option"; + } } - $domain = $domains[0]; + # prevent confusion due to possible help-* domain + my $project = qx_cmd ("meson introspect '$meson_builddir' --projectinfo | jq -r '.name'"); + chomp $project; + delete $domains{ 'help-'.$project }; + + if (keys %domains > 1) { + warning "more than one meson translation domain found (" . join (",", keys %domains) . "), don't know which one to use"; + return; + } - chomp $domain; + ($domain) = keys %domains; } if ($domain) { @@ -174,7 +200,7 @@ my $added_domain = 0; foreach (@lines) { # filter out translated fields - next if (/^(Name|GenericName|Comment|X-GNOME-FullName)\[/); + next if (/^(Name|GenericName|Comment|X-GNOME-FullName|Icon|Keywords)\[/); if (/^[A-Za-z-0-9-]*Gettext-Domain\s*=/) { $added_domain = 1; @@ -306,7 +332,9 @@ } } -init(); +init (options => { + 'domain=s' => \$dh{DOMAIN}, +}); check_buildsystem(); build_pot();