Package: lintian
Version: 1.24.1
Severity: wishlist
Tags: patch
It would be nice if lintian had a command-line option to print a tag's
description on-demand. I often come across a tag's name in a build-log or
elsewhere and I find myself running:
% grep tag-name-here /usr/share/lintian/collection/*.desc
and then opening the file to view the long description. I am aware of the
"--info" flag, but this only helps if you are controlling the lintian run.
Patch attached.
Regards,
--
Chris Lamb, UK chris@chris-lamb.co.uk
GPG: 0x634F9A20
diff --git a/frontend/lintian b/frontend/lintian
index 1be2e9b..25e24b4 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -80,6 +80,7 @@ my $unpack_info;
my $cwd;
my $cleanup_filename;
my $exit_code = 0;
+my $describe_tag;
my $LAB;
my %collection_info;
@@ -130,6 +131,7 @@ Actions:
-X X, --dont-check-part X don\'t check certain aspects
-u, --unpack only unpack packages in the lab
-r, --remove remove package from the lab
+ -D X, --describe X print description of a tag and then exit
General options:
-h, --help display short help text
-v, --verbose verbose messages
@@ -221,6 +223,18 @@ sub record_dont_check_part {
$dont_check = "$_[1]";
}
+# Record describe option
+# Options: -D|--describe
+sub record_describe {
+ if (defined $action and $action eq 'describe' and $describe_tag) {
+ die("multiple -D or --describe options not allowed");
+ }
+ if ($action) {
+ die("too many actions specified: $_[0]");
+ }
+ $action = 'describe';
+ $describe_tag = "$_[1]";
+}
# Process for -U|--unpack-info flag
sub record_unpack_info {
@@ -247,6 +261,7 @@ my %opthash = ( # ------------------ actions
"dont-check-part|X=s" => \&record_dont_check_part,
"unpack|u" => \&record_action,
"remove|r" => \&record_action,
+ "describe|D=s" => \&record_describe,
# ------------------ general options
"help|h" => \&syntax,
@@ -575,6 +590,13 @@ if ($action eq 'setup-lab') {
exit 0;
#######################################
+# Process -D option
+} elsif ($action eq 'describe') {
+ if ($#ARGV+1 > 0) {
+ die("Cannot specify -D|--describe and additional command line arguments.\n");
+ }
+
+#######################################
# Check for non deb specific actions
} elsif (not (($action eq 'unpack') or ($action eq 'check')
or ($action eq 'remove'))) {
@@ -880,7 +902,8 @@ while (my $arg = shift) {
}
}
-if (not $check_everything and not $packages_file and ($#packages == -1)) {
+if (not $check_everything and not $packages_file and ($#packages == -1)
+ and ($action ne "describe")) {
print "N: No packages selected.\n" if $verbose;
exit $exit_code;
}
@@ -1053,11 +1076,27 @@ for my $f (readdir CHECKDIR) {
}
shift(@secs);
- map Tags::add_tag($_), @secs;
+
+ if ($action eq "describe") {
+ for my $sec (@secs) {
+ if ($sec->{'tag'} eq $describe_tag) {
+ for (qw(tag type info ref)) {
+ print ucfirst($_) . ": $sec->{$_}\n";
+ }
+ exit 0;
+ }
+ }
+ } else {
+ map Tags::add_tag($_), @secs;
+ }
} # end: if ne lintian
}
+if ($action eq 'describe') {
+ die("Tag \"$describe_tag\" not found.\n");
+}
+
closedir(CHECKDIR);
# }}}
diff --git a/man/lintian.1 b/man/lintian.1
index 6d0d76b..0e85108 100644
--- a/man/lintian.1
+++ b/man/lintian.1
@@ -105,6 +105,10 @@ Clean up the lintian directory of the specified packages up to
the current unpack level. The default unpack level is 0 for
this option.
+.TP
+.BR \-D " tag, " \-\-describe " tag "
+Print a description of the specified tag and then exit.
+
.PP
General options:
Attachment:
signature.asc
Description: PGP signature