[SCM] Debian package checker branch, master, updated. 2.2.18-33-g3cfd89c
The following commit has been merged in the master branch:
commit 16edab9a028e22938239ecba389afc3dcfbad44f
Author: Russ Allbery <rra@debian.org>
Date: Sun Dec 20 19:21:38 2009 -0800
Add additional access methods to Lintian::Tag::Info
* lib/Lintian/Tag/Info.pm:
+ [RA] Add certainty and severity accessor methods.
+ [RA] Add a method saying whether a tag is experimental.
+ [RA] Record the check script corresponding to each tag and add an
accessor method for it.
+ [RA] Add a sources method returning a list of sources referenced by
a tag, based on the get_tag_source method from Tags.pm.
diff --git a/debian/changelog b/debian/changelog
index 5c44aae..6fddcb9 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,12 @@ lintian (2.2.19) UNRELEASED; urgency=low
+ [RA] Add a code method that returns the tag code corresponding to
the severity and certainty for a tag, based on get_tag_code from
Tags.pm.
+ + [RA] Add certainty and severity accessor methods.
+ + [RA] Add a method saying whether a tag is experimental.
+ + [RA] Record the check script corresponding to each tag and add an
+ accessor method for it.
+ + [RA] Add a sources method returning a list of sources referenced by
+ a tag, based on the get_tag_source method from Tags.pm.
* lib/Tags.pm:
+ [RA] Support suppressing a list of tags.
* lib/Util.pm:
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index fc5e13e..0d4dfaf 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -68,9 +68,8 @@ Lintian::Tag::Info - Lintian interface to tag metadata
=head1 DESCRIPTION
This module provides an interface to tag metadata as gleaned from the
-*.desc files describing the checks. Currently, it is only used to format
-and return the tag description, but it provides a framework that can be
-used to retrieve other metadata about tags.
+*.desc files describing the checks. It can be used to retrieve specific
+metadata elements or to format the tag description.
=head1 CLASS METHODS
@@ -105,6 +104,7 @@ sub _load_tag_data {
fail("missing Tag field in $desc");
}
$tag->{info} = '' unless exists($tag->{info});
+ $tag->{script} = $header->{'check-script'};
$INFO{$tag->{tag}} = $tag;
}
}
@@ -132,6 +132,17 @@ sub new {
=over 4
+=item certainty()
+
+Returns the certainty of the tag.
+
+=cut
+
+sub certainty {
+ my ($self) = @_;
+ return $self->{certainty};
+}
+
=item code()
Returns the one-letter code for the tag. This will be a letter chosen
@@ -287,6 +298,55 @@ sub description {
}
}
+=item experimental()
+
+Returns true if this tag is experimental, false otheriwse.
+
+=cut
+
+sub experimental {
+ my ($self) = @_;
+ return $self->{experimental} eq 'yes';
+}
+
+=item severity()
+
+Returns the severity of the tag.
+
+=cut
+
+sub severity {
+ my ($self) = @_;
+ return $self->{severity};
+}
+
+=item script()
+
+Returns the check script corresponding to this tag.
+
+=cut
+
+sub script {
+ my ($self) = @_;
+ return $self->{script};
+}
+
+=item sources()
+
+Returns, as a list, the keywords for the sources of this tag from the
+references header. This is only the top-level source, not any
+more-specific section or chapter.
+
+=cut
+
+sub sources {
+ my ($self) = @_;
+ return unless $self->{ref};
+ my @refs = split(',', $self->{ref});
+ @refs = map { s/^([\w-]+)\s.*/$1/; s/\(\S+\)$//; $_ } @refs;
+ return @refs;
+}
+
=back
=head1 DIAGNOSTICS
--
Debian package checker
Reply to: