/usr/bin/lintian-info is in lintian 2.5.10.4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | #!/usr/bin/perl -w
#
# lintian-info -- transform lintian tags into descriptive text
#
# Copyright (C) 1998 Christian Schwarz and Richard Braakman
#
# This program is free software. It is distributed under the terms of
# the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, you can find it on the World Wide
# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
use strict;
use warnings;
use Getopt::Long;
# turn file buffering off:
$| = 1;
BEGIN {
# determine LINTIAN_ROOT
my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'} || '/usr/share/lintian';
$ENV{'LINTIAN_ROOT'} = $LINTIAN_ROOT
unless exists $ENV{'LINTIAN_ROOT'};
}
# import perl libraries
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Lintian::Data;
use Lintian::Internal::FrontendUtil;
use Lintian::Profile;
my %already_displayed = ();
my @proc_inc;
# In some (rare) cases, $ENV{HOME} will not be available.
# - Handle that gracefully by not emitting "Uninitialized ...".
push @proc_inc, "$ENV{HOME}/.lintian/profiles" if defined $ENV{HOME};
push @proc_inc, '/etc/lintian/profiles', "$ENV{'LINTIAN_ROOT'}/profiles";
my ($annotate, $tags, $help, $prof);
my $profile;
Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
GetOptions(
'annotate|a' => \$annotate,
'tags|t' => \$tags,
'help|h' => \$help,
'profile=s' => \$prof,
) or die("error parsing options\n");
# help
if ($help) {
print <<"EOT";
Usage: lintian-info [log-file...] ...
lintian-info --annotate [overrides ...]
lintian-info --tags tag ...
Options:
-a, --annotate display descriptions of tags in Lintian overrides
-t, --tags display tag descriptions
--profile X use vendor profile X to determine severities
EOT
exit 0;
}
unless ($prof) {
$prof = find_default_profile(@proc_inc);
}
$profile = Lintian::Profile->new($prof, $ENV{'LINTIAN_ROOT'}, \@proc_inc);
Lintian::Data->set_vendor ($profile);
# If tag mode was specified, read the arguments as tags and display the
# descriptions for each one. (We don't currently display the severity,
# although that would be nice.)
my $unknown;
if ($tags) {
for my $tag (@ARGV) {
my $info = $profile->get_tag ($tag, 1);
if ($info) {
print $info->code . ": $tag\n";
print "N:\n";
print $info->description('text', 'N: ');
} else {
print "N: $tag\n";
print "N:\n";
print "N: Unknown tag.\n";
$unknown = 1;
}
print "N:\n";
}
exit ($unknown ? 1 : 0);
}
my $type_re = qr/(?:binary|changes|source|udeb)/o;
# Matches something like: (1:2.0-3) [arch1 arch2]
# - captures the version and the architectures
my $verarchre = qr,(?: \s* \( [^\)]++ \) \s* \[ [^\]]++ \]),xo;
# ^^^^^^^ ^^^^^^^
# ( version ) [architecture ]
# matches the full deal:
# 111
# - T: pkg type (version) [arch]: tag [...]
# ^^^^^^^^^^^^^^^^^^^^^
# Where the marked part(s) are optional values. The numbers above the example
# are the capture groups.
my $fullre = qr/[EWIXOP]: \S+(?: $type_re(?:$verarchre)?)?: (\S+)(?:\s+.*)?/o;
# Otherwise, read input files or STDIN, watch for tags, and add descriptions
# whenever we see one, can, and haven't already explained that tag. Strip off
# color and HTML sequences.
while (<>) {
print;
chomp;
next if /^\s*$/;
s/\e[\[\d;]*m//g;
s/<span style=\"[^\"]+\">//g;
s,</span>,,g;
my $tag;
my $type;
if ($annotate) {
my $tagdata;
next unless m/^(?: # start optional part
(?:\S+)? # Optionally starts with package name
(?: \s*+ \[[^\]]+?\])? # optionally followed by an [arch-list] (like in B-D)
(?: \s*+ $type_re)? # optionally followed by the type
:\s++)? # end optional part
([\-\.a-zA-Z_0-9]+ (?:\s.+)?)$/ox; # <tag-name> [extra] -> $1
$tagdata = $1;
($tag, undef) = split m/ /o, $tagdata, 2;
} else {
next unless m/^$fullre$/o;
$tag = $1;
}
next if $already_displayed{$tag}++;
my $info = $profile->get_tag ($tag, 1);
next unless $info;
print "N:\n";
print $info->description('text', 'N: ');
print "N:\n";
}
exit 0;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
|