[SCM] Debian package checker branch, master, updated. 2.1.4-13-gfcfd5f7
The following commit has been merged in the master branch:
commit fcfd5f79046303b7f9590e9bf5182abc4d7501c6
Author: Russ Allbery <rra@debian.org>
Date: Sat Jan 10 21:31:12 2009 -0800
Canonicalize extra tag information in only one place
* lib/Lintian/{Output.pm,Output/*.pm}:
+ [RA] Expect a single string of extra information rather than an
array, removing duplicate code to convert it to a string.
* lib/Tags.pm:
+ [RA] Canonicalize the extra tag information once and pass it as a
string to the other output methods. Based on a patch by Raphael
Geissert. (Closes: #498883)
diff --git a/debian/changelog b/debian/changelog
index eb9f206..5d5ab14 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,9 @@ lintian (2.1.5) UNRELEASED; urgency=low
* lib/Lintian/Check.pm:
+ [RA] New module for checks run from multiple places.
+ * lib/Lintian/{Output.pm,Output/*.pm}:
+ + [RA] Expect a single string of extra information rather than an
+ array, removing duplicate code to convert it to a string.
* lib/Lintian/Schedule.pm:
+ [RA] Fix Perl warnings triggered by missing fields in the control
file of a binary package.
@@ -45,6 +48,11 @@ lintian (2.1.5) UNRELEASED; urgency=low
+ [RA] Avoid Perl warnings if Severity or Certainty isn't set for a
tag. (Closes: #507278)
+ [RA] Record statistics for certainty correctly.
+ + [RA] Canonicalize the extra tag information once and pass it as a
+ string to the other output methods. Based on a patch by Raphael
+ Geissert. (Closes: #498883)
+ + [RA] Fix override checking with extra tag information that Perl
+ evaluates to false (such as a bare 0).
* man/lintian.1:
+ [RA] Document new deb-format check script.
diff --git a/lib/Lintian/Output.pm b/lib/Lintian/Output.pm
index d92df4f..6a37ccc 100644
--- a/lib/Lintian/Output.pm
+++ b/lib/Lintian/Output.pm
@@ -277,10 +277,7 @@ about the package and the tag, $extra is the extra information for the tag
sub print_tag {
my ($self, $pkg_info, $tag_info, $information) = @_;
-
- my $extra = '';
- $extra = " @$information" if @$information;
- $extra = '' if $extra eq ' ';
+ $information = ' ' . $information if $information ne '';
my $code = Tags::get_tag_code($tag_info);
my $tag_color = $self->{colors}{$code};
$code = 'X' if exists $tag_info->{experimental};
@@ -299,7 +296,7 @@ sub print_tag {
$tag .= $tag_info->{tag};
}
- $self->_print('', "$code: $pkg_info->{pkg}$type", "$tag$extra");
+ $self->_print('', "$code: $pkg_info->{pkg}$type", "$tag$information");
if (!$self->issued_tag($tag_info->{tag}) and $self->showdescription) {
$self->_print('', 'N', '');
$self->_print('', 'N', split("\n", format_tag_description($tag_info, 3)));
diff --git a/lib/Lintian/Output/ColonSeparated.pm b/lib/Lintian/Output/ColonSeparated.pm
index 2d58ca2..aee8573 100644
--- a/lib/Lintian/Output/ColonSeparated.pm
+++ b/lib/Lintian/Output/ColonSeparated.pm
@@ -29,8 +29,6 @@ use base qw(Lintian::Output);
sub print_tag {
my ($self, $pkg_info, $tag_info, $information) = @_;
- my $extra = "@$information";
-
$self->issued_tag($tag_info->{tag});
$self->_print(
'tag',
@@ -41,7 +39,7 @@ sub print_tag {
($tag_info->{overridden}{override} ? 'O' : ''),
@{$pkg_info}{'pkg','version','arch','type'},
$tag_info->{tag},
- $extra,
+ $information,
$tag_info->{overridden}{override} || '',
);
}
diff --git a/lib/Lintian/Output/LetterQualifier.pm b/lib/Lintian/Output/LetterQualifier.pm
index 563e0b3..b90c2bd 100644
--- a/lib/Lintian/Output/LetterQualifier.pm
+++ b/lib/Lintian/Output/LetterQualifier.pm
@@ -109,8 +109,7 @@ sub print_tag {
my $tag = $tag_info->{tag};
- my $extra = @$information ? " @$information" : '';
- $extra = '' if $extra eq ' ';
+ $information = ' ' . $information if $information ne '';
if ($self->_do_color) {
my $color = $self->colors->{$sev}{$cer};
@@ -118,7 +117,7 @@ sub print_tag {
$tag = colored($tag, $color);
}
- $self->_print('', "$code\[$lq\]: $pkg$type", "$tag$extra");
+ $self->_print('', "$code\[$lq\]: $pkg$type", "$tag$information");
if (!$self->issued_tag($tag_info->{tag}) and $self->showdescription) {
$self->_print('', 'N', '');
$self->_print('', 'N', split("\n", format_tag_description($tag_info, 3)));
diff --git a/lib/Lintian/Output/XML.pm b/lib/Lintian/Output/XML.pm
index 0041e53..ff0ebc4 100644
--- a/lib/Lintian/Output/XML.pm
+++ b/lib/Lintian/Output/XML.pm
@@ -33,7 +33,7 @@ sub print_tag {
qq{<tag severity="$tag_info->{severity}" certainty="$tag_info->{certainty}"},
'flags="'.(exists($tag_info->{experimental}) ? 'experimental' : ''),
($tag_info->{overridden}{override} ? 'overridden' : '').'"',
- qq{name="$tag_info->{tag}">}.encode_entities("@$information","<>&\"'").qq{</tag>},
+ qq{name="$tag_info->{tag}">}.encode_entities("$information","<>&\"'").qq{</tag>},
);
}
diff --git a/lib/Tags.pm b/lib/Tags.pm
index 9d7fa49..2b4b2cc 100644
--- a/lib/Tags.pm
+++ b/lib/Tags.pm
@@ -205,8 +205,6 @@ sub get_tag_code {
sub check_overrides {
my ( $tag_info, $information ) = @_;
- my $extra = '';
- $extra = "@$information" if @$information;
my $tag = $tag_info->{tag};
my $overrides = $info{$current}{overrides}{$tag};
return unless $overrides;
@@ -214,17 +212,17 @@ sub check_overrides {
if( exists $overrides->{''} ) {
$overrides->{''}++;
return $tag;
- } elsif( $extra and exists $overrides->{$extra} ) {
- $overrides->{$extra}++;
- return "$tag $extra";
- } elsif ( $extra ) {
+ } elsif( $information ne '' and exists $overrides->{$information} ) {
+ $overrides->{$information}++;
+ return "$tag $information";
+ } elsif ( $information ne '' ) {
foreach (keys %$overrides) {
my $regex = $_;
if (m/^\*/ or m/\*$/) {
my ($start, $end) = ("","");
$start = '.*' if $regex =~ s/^\*//;
$end = '.*' if $regex =~ s/\*$//;
- if ($extra =~ /^$start\Q$regex\E$end$/) {
+ if ($information =~ /^$start\Q$regex\E$end$/) {
$overrides->{$_}++;
return "$tag $_";
}
@@ -328,8 +326,13 @@ sub tag {
return 0 unless
! keys %only_issue_tags or exists $only_issue_tags{$tag};
- # Newlines in @information would cause problems, so replace them with \n.
- @information = grep { defined($_) and $_ ne '' } map { s,\n,\\n,; $_ } @information;
+ # Clean up @information and collapse it to a string. Lintian code doesn't
+ # treat the distinction between extra arguments to tag() as significant,
+ # so we may as well take care of this up front.
+ @information = grep { defined($_) and $_ ne '' }
+ map { s,\n,\\n,; $_ } @information;
+ my $information = join(' ', @information);
+ $information = '' unless defined $information;
my $tag_info = get_tag_info( $tag );
unless ($tag_info) {
@@ -337,14 +340,14 @@ sub tag {
return 0;
}
- set_overrides( $tag_info, \@information );
+ set_overrides( $tag_info, $information );
record_stats( $tag_info );
return 1 if skip_print( $tag_info );
$Lintian::Output::GLOBAL->print_tag( $info{$current}, $tag_info,
- \@information );
+ $information );
return 1;
}
--
Debian package checker
Reply to: