lintian: r251 - in trunk: frontend lib
Author: jeroen
Date: 2004-05-03 01:42:13 +0200 (Mon, 03 May 2004)
New Revision: 251
Modified:
trunk/frontend/lintian
trunk/lib/Checker.pm
trunk/lib/Tags.pm
Log:
A bit of cleanup, and overrides should work again (no show-unused-overrides
iff verbose though, but that's also not THAT useful)
Modified: trunk/frontend/lintian
===================================================================
--- trunk/frontend/lintian 2004-05-02 19:07:37 UTC (rev 250)
+++ trunk/frontend/lintian 2004-05-02 23:42:13 UTC (rev 251)
@@ -877,6 +877,7 @@
no warnings;
$Tags::show_info = $display_infotags;
+$Tags::show_overrides = $show_overrides;
use warnings;
# load information about checker scripts
@@ -1234,24 +1235,24 @@
}
if ($action eq 'check') { # read override file
+ Tags::pkg_reset($type eq 'binary' ? $pkg : "$pkg $type");
+
+
unless ($no_override)
{ if ( open(O,"$base/override") )
{
- binmode(O);
while (<O>) {
chomp;
- next if m,^\#,o;
+ next if m,^\s*(\#|$),o;
+ # TODO: warn if no $pkg: thing is there...
+ s/^$pkg://;
s/^\s+//o;
s/\s+$//o;
s/\s+/ /go;
next if $_ eq '';
-# if ( defined( $overridden{$_} ) ) {
-# print "N: Local override not needed in package $pkg: $_\n" if $verbose;
-# } else {
-# $overridden{$_} = 0;
-# }
+ Tags::add_override($_);
}
close(O);
}
@@ -1292,8 +1293,8 @@
}
# report unused overrides
- if (not $no_override and $verbose) {
- my $ppkg = $type eq 'b' ? quotemeta($pkg) : quotemeta("$pkg $long_type");
+# if (not $no_override and $verbose) {
+# my $ppkg = $type eq 'b' ? quotemeta($pkg) : quotemeta("$pkg $long_type");
# for my $o (sort keys %overridden) {
# next unless $o =~ /^$ppkg:/;
# next if $overridden{$o};
@@ -1303,7 +1304,7 @@
# # mark override entry as used
# $overridden{$o} = 99999;
# }
- }
+# }
}
# chdir to lintian root directory (to unlock $base so it can be removed below)
Modified: trunk/lib/Checker.pm
===================================================================
--- trunk/lib/Checker.pm 2004-05-02 19:07:37 UTC (rev 250)
+++ trunk/lib/Checker.pm 2004-05-02 23:42:13 UTC (rev 251)
@@ -1,7 +1,7 @@
# Checker -- Perl checker functions for lintian
# $Id$
-# Copyright (C) 1998-2004 Various authors
+# Copyright (C) 2004 Jeroen van Wolffelaar
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,12 +34,9 @@
my $verbose = $::verbose;
my $debug = $::debug;
-# Not very neat to do like this... but the code wasn't neat to begin with :-/
-my $display_infotags = $::display_infotags;
-my $no_override = $::no_override;
-my $show_overrides = $::show_overrides;
-
my %checks;
+# For source, binary, udeb, the names of applicable checks
+my %checks_per_type;
# Register a check. Argument is a hash with info
sub register {
Modified: trunk/lib/Tags.pm
===================================================================
--- trunk/lib/Tags.pm 2004-05-02 19:07:37 UTC (rev 250)
+++ trunk/lib/Tags.pm 2004-05-02 23:42:13 UTC (rev 251)
@@ -44,13 +44,15 @@
# - experimental: experimental status (possibly undef)
my %tags;
+our $show_overrides;
+# in the form overrides->tag or full thing
+my %overrides;
+
my $codes = { 'error' => 'E' , 'warning' => 'W' , 'info' => 'I' };
# TODO
-# - override support back in
-# - info display configurable
-# - understand 'reset'
+# - override support back in --> just the unused reporting
# - be able to return whether any errors were there, better, full stats
# Call this function to add a certain tag, by supplying the info as a hash
@@ -62,6 +64,19 @@
$tags{$newtag->{'tag'}} = $newtag;
}
+# Used to reset the matched tags data
+sub pkg_reset {
+ $prefix = shift;
+ *overrides = {};
+}
+
+# Add an override, string tag, string rest
+sub add_override {
+ my $tag = shift;
+ $overrides{$tag} = 0;
+}
+
+
sub tag {
my $tag = shift;
my $info = $tags{$tag};
@@ -69,8 +84,13 @@
my $extra = '';
$extra = ' '.join(' ', @_) if $#_ >=0;
$extra = '' if $extra eq ' ';
+ my $code = $codes->{$info->{'type'}};
+ if (exists $overrides{$tag} or exists $overrides{"$tag$extra"}) {
+ return unless $show_overrides;
+ $code = 'O';
+ }
- print "$codes->{$info->{'type'}}: $prefix: $tag$extra\n";
+ print "$code: $prefix: $tag$extra\n";
}
1;
Reply to: