[SCM] Debian package checker branch, master, updated. 2.1.0-21-gd15f010
The following commit has been merged in the master branch:
commit 0e05bc37bf8ff60f849c7e3d5b33ea995c25d304
Author: Adam D. Barratt <adam@adam-barratt.org.uk>
Date: Sun Dec 7 15:32:48 2008 +0000
Optionally print the description of a tag when displaying it.
* lib/Lintian/Output.pm:
+ Maintain a list of tags which have been issued. We only want to print
a particular tag's description once.
+ Optionally include the description of a tag when displaying it.
* lib/Lintian/Output{.pm,/*.pm}:
+ Flag a tag as issued when printing it.
* lib/Lintian/Output/LetterQualifier.pm:
+ Optionally include the description of a tag when displaying it.
diff --git a/lib/Lintian/Output.pm b/lib/Lintian/Output.pm
index 02beb03..22d0008 100644
--- a/lib/Lintian/Output.pm
+++ b/lib/Lintian/Output.pm
@@ -62,6 +62,7 @@ $Lintian::Output::GLOBAL unless their first argument C<isa('Lintian::Output')>.
# support for ANSI color output via colored()
use Term::ANSIColor ();
use Tags ();
+use Read_taginfo qw(format_tag_description);
=head1 ACCESSORS
@@ -98,12 +99,21 @@ I/O handle to use for output of messages and tags. Defaults to C<\*STDOUT>.
I/O handle to use for warnings. Defaults to C<\*STDERR>.
+=item showdescription
+
+Whether to show the description of a tag when printing it.
+
+=item issuedtags
+
+Hash containing the names of tags which have been issued.
+
=back
=cut
use base qw(Class::Accessor Exporter);
-Lintian::Output->mk_accessors(qw(verbose debug quiet color colors stdout stderr));
+Lintian::Output->mk_accessors(qw(verbose debug quiet color colors stdout
+ stderr showdescription issuedtags));
our @EXPORT = ();
our %EXPORT_TAGS = ( messages => [qw(msg v_msg warning debug_msg delimiter)],
@@ -126,6 +136,7 @@ sub new {
$self->stdout(\*STDOUT);
$self->stderr(\*STDERR);
$self->colors({%default_colors});
+ $self->issuedtags({});
return $self;
}
@@ -209,6 +220,19 @@ sub delimiter {
return $self->_delimiter;
}
+=item C<issued_tag($tag_name)>
+
+Indicate that the named tag has been issued. Returns a boolean value
+indicating whether the tag had previously been issued by the object.
+
+=cut
+
+sub issued_tag {
+ my ($self, $tag_name) = _global_or_object(@_);
+
+ return $self->issuedtags->{$tag_name}++ ? 1 : 0;
+}
+
=item C<string($lead, @args)>
TODO: Is this part of the public interface?
@@ -269,6 +293,11 @@ sub print_tag {
}
$self->_print('', "$code: $pkg_info->{pkg}$type", "$tag$extra");
+ if (!$self->issued_tag($tag_info->{tag}) and $self->showdescription) {
+ $self->_print('', 'N', '');
+ $self->_print('', 'N', split("\n", format_tag_description($tag_info, 3)));
+ $self->_print('', 'N', '');
+ }
}
=item C<print_start_pkg($pkg_info)>
diff --git a/lib/Lintian/Output/ColonSeparated.pm b/lib/Lintian/Output/ColonSeparated.pm
index 8bce0a6..2d58ca2 100644
--- a/lib/Lintian/Output/ColonSeparated.pm
+++ b/lib/Lintian/Output/ColonSeparated.pm
@@ -31,6 +31,7 @@ sub print_tag {
my $extra = "@$information";
+ $self->issued_tag($tag_info->{tag});
$self->_print(
'tag',
Tags::get_tag_code($tag_info),
diff --git a/lib/Lintian/Output/LetterQualifier.pm b/lib/Lintian/Output/LetterQualifier.pm
index eaffc42..563e0b3 100644
--- a/lib/Lintian/Output/LetterQualifier.pm
+++ b/lib/Lintian/Output/LetterQualifier.pm
@@ -21,6 +21,7 @@ package Lintian::Output::LetterQualifier;
use strict;
use warnings;
+use Read_taginfo qw(format_tag_description);
use Term::ANSIColor qw(colored);
use Tags ();
@@ -118,6 +119,11 @@ sub print_tag {
}
$self->_print('', "$code\[$lq\]: $pkg$type", "$tag$extra");
+ if (!$self->issued_tag($tag_info->{tag}) and $self->showdescription) {
+ $self->_print('', 'N', '');
+ $self->_print('', 'N', split("\n", format_tag_description($tag_info, 3)));
+ $self->_print('', 'N', '');
+ }
}
1;
diff --git a/lib/Lintian/Output/XML.pm b/lib/Lintian/Output/XML.pm
index e86f81d..0041e53 100644
--- a/lib/Lintian/Output/XML.pm
+++ b/lib/Lintian/Output/XML.pm
@@ -28,6 +28,7 @@ use base qw(Lintian::Output);
sub print_tag {
my ($self, $pkg_info, $tag_info, $information) = @_;
+ $self->issued_tag($tag_info->{tag});
$self->_print_xml('',
qq{<tag severity="$tag_info->{severity}" certainty="$tag_info->{certainty}"},
'flags="'.(exists($tag_info->{experimental}) ? 'experimental' : ''),
--
Debian package checker
Reply to: