[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

lintian: r1043 - in trunk: debian frontend lib testset



Author: rra
Date: 2007-12-04 10:18:03 +0100 (Tue, 04 Dec 2007)
New Revision: 1043

Modified:
   trunk/debian/changelog
   trunk/frontend/lintian
   trunk/lib/Tags.pm
   trunk/testset/runtests
   trunk/testset/tags.libbaz
   trunk/testset/tags.manpages
Log:
  + [RA] Display a summary of overridden tags as an N: output line.
    Requested by Steve McIntyre.  (Closes: #452804)
* lib/Tags.pm:
  + [RA] Keep statistics on overrides by severity.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2007-12-04 08:43:53 UTC (rev 1042)
+++ trunk/debian/changelog	2007-12-04 09:18:03 UTC (rev 1043)
@@ -95,6 +95,8 @@
     + [RA] Add critical as a recognized urgency.
     + [RA] Diagnose malformed override entries; don't just ignore them.
     + [RA] Fix some odd formatting.
+    + [RA] Display a summary of overridden tags as an N: output line.
+      Requested by Steve McIntyre.  (Closes: #452804)
 
   * man/lintian.1:
     + [RA] Be clearer about what files lintian takes as arguments; in
@@ -106,13 +108,15 @@
     + [RA] Remove.  This isn't used by anything and would produce
       incorrect results (it doesn't understand ~), and Dep.pm provides
       version comparison routines that use dpkg.
+  * lib/Tags.pm:
+    + [RA] Keep statistics on overrides by severity.
 
   * unpack/list-srcpkg:
     + [RA] Escape ; and newline characters in all package fields before
       writing them to the index (uncovered when someone accidentally
       appended a package description to Standards-Version).
 
- -- Russ Allbery <rra@debian.org>  Tue, 04 Dec 2007 00:34:36 -0800
+ -- Russ Allbery <rra@debian.org>  Tue, 04 Dec 2007 00:59:20 -0800
 
 lintian (1.23.36) unstable; urgency=low
 

Modified: trunk/frontend/lintian
===================================================================
--- trunk/frontend/lintian	2007-12-04 08:43:53 UTC (rev 1042)
+++ trunk/frontend/lintian	2007-12-04 09:18:03 UTC (rev 1043)
@@ -1343,6 +1343,30 @@
 		tag( "unused-override", $o );
 	    }
 	}
+
+        # Report override statistics.  The way pluralization is handled here
+        # is not even remotely good for translations, but lintian doesn't
+        # handle translations now anyway and this isn't the worst problem.
+        if (not $no_override and not $show_overrides) {
+            my $stats = Tags::get_stats($file);
+            my $short = $file;
+            $short =~ s%.*/%%;
+            my $errors = $stats->{overrides}{by_severity}{4};
+            my $warnings = $stats->{overrides}{by_severity}{2};
+            if ($errors) {
+                $errors = ($errors == 1) ? "$errors error" : "$errors errors";
+            }
+            if ($warnings) {
+                $warnings = ($warnings == 1) ? "$warnings warning" : "$warnings warnings";
+            }
+            if ($errors and $warnings) {
+                print "N: $short overrode $errors, $warnings\n";
+            } elsif ($errors) {
+                print "N: $short overrode $errors\n";
+            } elsif ($warnings) {
+                print "N: $short overrode $warnings\n";
+            }
+        }
     }
 
     # chdir to lintian root directory (to unlock $base so it can be removed below)

Modified: trunk/lib/Tags.pm
===================================================================
--- trunk/lib/Tags.pm	2007-12-04 08:43:53 UTC (rev 1042)
+++ trunk/lib/Tags.pm	2007-12-04 09:18:03 UTC (rev 1043)
@@ -253,6 +253,9 @@
 	$stats{$current}{overrides}{$k}{$tag_info->{overridden}{$k}}++
 	    if $tag_info->{overridden}{$k};
     }
+    if ($tag_info->{overridden}{override}) {
+        $stats{$current}{overrides}{by_severity}{$tag_info->{severity}}++;
+    }
 }
 
 # get the statistics for a file (one argument) or for all files (no argument)

Modified: trunk/testset/runtests
===================================================================
--- trunk/testset/runtests	2007-12-04 08:43:53 UTC (rev 1042)
+++ trunk/testset/runtests	2007-12-04 09:18:03 UTC (rev 1043)
@@ -254,6 +254,7 @@
 
     open TAGS, "$rundir/tags.$pkg" or fail("Cannot open $rundir/tags.$pkg");
     while (<TAGS>) {
+	next if /^N: /;
 	if (not /^(.): (\S+)(?: (?:source|udeb))?: (\S+)/) {
 	    print "E: Invalid line:\n$_";
 	    next;

Modified: trunk/testset/tags.libbaz
===================================================================
--- trunk/testset/tags.libbaz	2007-12-04 08:43:53 UTC (rev 1042)
+++ trunk/testset/tags.libbaz	2007-12-04 09:18:03 UTC (rev 1043)
@@ -20,6 +20,7 @@
 I: libbaz1: several-sonames-in-same-package libbaz2.so.1.0 libbaz3.so.1
 I: libbaz2-dev: no-md5sums-control-file
 I: libbaz2: no-md5sums-control-file
+N: libbaz_1.dsc overrode 4 warnings
 W: libbaz source: ancient-standards-version 3.2.1 (current is 3.7.3)
 W: libbaz source: changelog-should-mention-nmu
 W: libbaz source: no-section-field

Modified: trunk/testset/tags.manpages
===================================================================
--- trunk/testset/tags.manpages	2007-12-04 08:43:53 UTC (rev 1042)
+++ trunk/testset/tags.manpages	2007-12-04 09:18:03 UTC (rev 1043)
@@ -33,6 +33,7 @@
 E: manpages: x11-games-should-be-in-usr-games usr/X11R6/man/man6/X11R6-binary.man
 I: manpages: no-md5sums-control-file
 I: manpages: unused-override foo-tag-that-does-not-exist
+N: manpages_4-0.0.1_all.deb overrode 1 error
 W: manpages source: ancient-standards-version 3.2.1 (current is 3.7.3)
 W: manpages source: binary-nmu-debian-revision-in-source 4-0.0.1
 W: manpages source: changelog-should-mention-nmu



Reply to: