Commit 6075601f authored by Felix Lechner's avatar Felix Lechner

Capture output from intltool-update and show as N: messages instead of plain print.

The tag parsing tool tagextract transforms both the expected tags and
the actual tags into a universal format for comparison. Discarding
input lines is dangerous, as two empty files will always match.  An
error may always produce positive test results.

For that reason, tagextract discards only lines starting with 'N:'. It
fails on other, unexpected input. This commit converts the direct
messages printed by intltool-update into messages starting with N:.
While the information is still printed for the user, the new format
makes it safe to discard those lines when comparing tags.

This behavior may change if the expected tags are converted into the
universal format on disk in the future. In that case, the expected
tags would never be modified and always stand on their own. The runner
would also be faster. The matter is under consideration.

Gbp-Dch: ignore
parent 361ce8d1
......@@ -23,13 +23,18 @@ use strict;
use warnings;
use autodie;
use Capture::Tiny qw(capture_merged);
use Cwd qw(realpath);
use File::Temp();
use Try::Tiny;
use Lintian::Command qw(spawn);
use Lintian::Output qw(msg);
use Lintian::Tags qw(tag);
use Lintian::Util qw(clean_env copy_dir run_cmd);
use constant NEWLINE => qq{\n};
sub run {
my (undef, undef, $info) = @_;
my $has_template = 0;
......@@ -187,8 +192,10 @@ sub run {
if $d_templates;
# Generate a "test.pot" (in a tempdir)
if (
!eval {
my $error;
my ($output) = capture_merged {
try {
run_cmd(
\%intltool_opts,
......@@ -196,7 +203,17 @@ sub run {
'--gettext-package=test','--pot'
);
}
) {
catch {
# catch any error
$error = $_;
};
};
my @messages = split(NEWLINE, $output);
chomp @messages;
msg $_ for @messages;
if ($error) {
tag 'invalid-potfiles-in';
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment