Commit c5e301b9 authored by Felix Lechner's avatar Felix Lechner

Let tagadjust operate on universal tag files.

No longer extracts universal tags from the tag file given on the
command line. Instead assumes the file is in universal format already.
Likewise, any edits for purposes of calibration are no longer made in
the EWI format but directly in the universal tag format.

Also sorts the output in the preferred order for universal tags, since
they are now all sorted in the test specifications.

Gbp-Dch: ignore
parent 58abbc5d
......@@ -51,7 +51,6 @@ BEGIN {
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Lintian::Profile;
use Test::Lintian::Output::Universal qw(parse_line order);
use constant EMPTY => q{};
......@@ -85,12 +84,7 @@ my ($diffpath, $tagspath) = @ARGV;
my @difflines = path($diffpath)->lines_utf8;
chomp @difflines;
my $extractpath = Path::Tiny->tempfile;
die "Cannot execute tagextract on $tagspath: $!"
if
system('t/bin/tagextract', '-f', 'EWI', $tagspath, $extractpath->stringify);
my @tagslines = $extractpath->lines_utf8;
my @tagslines = path($tagspath)->lines_utf8;
chomp @tagslines;
my $changed;
......@@ -138,42 +132,13 @@ foreach my $line (@difflines) {
exit unless $changed;
my $profile = Lintian::Profile->new(undef, [$ENV{LINTIAN_ROOT}]);
# also sort output into preferred order
my $joined = EMPTY;
# do not sort until all tag specifications are kept in sorted order
#$joined .= $_ . NEWLINE for reverse sort { order($a) cmp order($b) } @tagslines;
$joined .= pretty2ewi($profile, $_) . NEWLINE for @tagslines;
$joined .= $_ . NEWLINE for reverse sort { order($a) cmp order($b) } @tagslines;
Please register or sign in to reply
path($tagspath)->spew_utf8($joined);
exit;
sub pretty2ewi {
my ($profile, $line) = @_;
return EMPTY unless defined $line;
my ($package, $type, $name, $details)= parse_line($line);
my $taginfo = $profile->get_tag($name);
die "Cannot find tag $name"
unless $taginfo;
my $letter = $taginfo->code;
$letter = 'X' if $taginfo->experimental;
my $string = $letter . COLON . SPACE . $package;
$string .= SPACE . $type
unless $type eq 'binary';
$string .= COLON . SPACE . $name;
$string .= SPACE . $details
if length $details;
return $string;
}
sub usage {
print <<"END";
Usage: $0 -i <tagdiff-file> <tags-file>
......
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