diff -ru pkgbinarymangler-138.orig/debian/changelog pkgbinarymangler-138/debian/changelog --- pkgbinarymangler-138.orig/debian/changelog 2018-04-20 17:17:19.000000000 +0200 +++ pkgbinarymangler-138/debian/changelog 2018-05-08 20:11:02.419785804 +0200 @@ -1,3 +1,17 @@ +pkgbinarymangler (139) bionic; urgency=medium + + * dh_translations: + - Prevent domain confusion for Meson packages when a help-* domain + is present (LP: #1762889). + - Don't build help-*.pot. Those templates are used to build static + localized XML pages, and we don't want to create LP templates and + deal with exported LP translations for such pages anyway. + - 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 Tue, 08 May 2018 20:11:00 +0200 + pkgbinarymangler (138) bionic; urgency=medium * dh_builddeb: Don't lock for dbgsym packages; we don't act on them. Revert diff -ru pkgbinarymangler-138.orig/dh_translations pkgbinarymangler-138/dh_translations --- pkgbinarymangler-138.orig/dh_translations 2018-04-09 11:20:18.000000000 +0200 +++ pkgbinarymangler-138/dh_translations 2018-05-08 20:02:50.304845326 +0200 @@ -25,7 +25,9 @@ =item -Try to build a current PO template. +Try to build a current PO template. Only the main gettext domain of the +project is dealt with; dh_translations does not build help-* templates or +other additional translation templates. =item @@ -36,6 +38,19 @@ =back +=head1 OPTIONS + +=over 4 + +=item B<--domain=>I + +The gettext domain can be passed through this option. This is useful for +packages with the Meson build system to tell dh_translations which domain +to use if there are multiple candidates. It's also useful for other +packages if dh_translations fails to find the correct domain by itself. + +=back + =cut my ($domain, $use_intltool, $meson_builddir); @@ -111,16 +126,32 @@ 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); - - if ($#domains >= 1) { - warning "more than one meson translation domain found (" . join (",", @domains) . "), don't know which one to use"; - return; - } + my @domains = split (' ', $all_domains); - $domain = $domains[0]; + if ($dh{DOMAIN}) { + if (grep { $_ eq $dh{DOMAIN} } @domains) { + $domain = $dh{DOMAIN}; + } else { + error "ERROR - domain $dh{DOMAIN}, which was passed as option, is unknown to Meson"; + } + } else { + # prevent confusion due to possible help-* domain + my $project = qx_cmd ("meson introspect '$meson_builddir' --projectinfo | jq -r '.name'"); + chomp $project; + @domains = grep { $_ ne 'help-'.$project } @domains; + + if ($#domains >= 1) { + warning "more than one meson translation domain found (" . join (",", @domains) . "), don't know which one to use"; + return; + } - chomp $domain; + $domain = $domains[0]; + } + } else { + # for non-Meson packages, use the domain passed as option if any + if ($dh{DOMAIN}) { + $domain = $dh{DOMAIN}; + } } if ($domain) { @@ -157,13 +188,6 @@ chdir 'po'; system @cmd; chdir '..'; - - # try to build help POT - if (-e 'help/Makefile') { - chdir 'help'; - system ('make', 'pot'); - chdir '..'; - } } # strip translations and add domain to *.desktop/*.directory @@ -174,7 +198,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 +330,9 @@ } } -init(); +init (options => { + 'domain=s' => \$dh{DOMAIN}, +}); check_buildsystem(); build_pot();