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

lintian: r1118 - in trunk: debian frontend man testset



Author: rra
Date: 2008-01-05 23:33:41 +0100 (Sat, 05 Jan 2008)
New Revision: 1118

Modified:
   trunk/debian/changelog
   trunk/frontend/lintian
   trunk/man/lintian.1
   trunk/testset/tags.libbaz
   trunk/testset/tags.manpages
Log:
  + [RA] Merge all override messages into a single message per run.  Add
    -q/--quiet option to suppress that message.  (Closes: #457513)
  + [RA] Document the --color=html and -q/--quiet options.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-01-05 18:57:07 UTC (rev 1117)
+++ trunk/debian/changelog	2008-01-05 22:33:41 UTC (rev 1118)
@@ -92,6 +92,8 @@
     + [RA] Reference GPL-2, not the GPL symlink, reflecting our license.
 
   * frontend/lintian:
+    + [RA] Merge all override messages into a single message per run.  Add
+      -q/--quiet option to suppress that message.  (Closes: #457513)
     + [RA] Allow + and . in tag names in overrides.  Thanks, Stefan
       Fritsch.  (Closes: #454790)
     + [RA] Check that the argument to --color is valid.
@@ -117,7 +119,7 @@
     + [RA] Add support for HTML coloring.
 
   * man/lintian.1:
-    + [RA] Document the --color=html option.
+    + [RA] Document the --color=html and -q/--quiet options.
   * man/lintian-info.1:
     + [RA] Document the --annotate option.
 

Modified: trunk/frontend/lintian
===================================================================
--- trunk/frontend/lintian	2008-01-05 18:57:07 UTC (rev 1117)
+++ trunk/frontend/lintian	2008-01-05 22:33:41 UTC (rev 1118)
@@ -45,6 +45,7 @@
 use vars qw($verbose);
 $verbose = 0;			#flag for -v|--verbose switch
 our $debug = 0;    	     	#flag for -d|--debug switch
+our $quiet = 0;			#flag for -q|--quiet switch
 my @debug;
 my $check_everything = 0;	#flag for -a|--all switch
 my $lintian_info = 0;		#flag for -i|--info switch
@@ -131,8 +132,9 @@
     -h, --help                display short help text
     -v, --verbose             verbose messages
     -V, --version             display Lintian version and exit
+    --print-version           print unadorned version number and exit
     -d, --debug               turn Lintian\'s debug messages ON
-    --print-version           print unadorned version number and exit
+    -q, --quiet               suppress all informational messages
 Behaviour options:
     -i, --info                give detailed info about tags
     -I, --display-info        display "I:" tags (normally suppressed)
@@ -249,6 +251,7 @@
 
 	       "verbose|v" => \$verbose,
 	       "debug|d" => \@debug, # Count the -d flags
+	       "quiet|q" => \$quiet,
 
 	       # ------------------ behaviour options
 	       "info|i" => \$lintian_info,
@@ -1143,6 +1146,7 @@
 # for each package (the `reverse sort' is to make sure that source packages are
 # before the corresponding binary packages--this has the advantage that binary
 # can use information from the source packages if these are unpacked)
+my %overrides;
 PACKAGE:
 for (reverse sort @packages) {
     m/^([bsu]) (\S+) (\S+) (.+)$/ or fail("internal error: syntax error in \@packages array: $_");
@@ -1359,28 +1363,15 @@
 	    }
 	}
 
-        # 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.
+        # Report override statistics.
         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";
-            }
+            my $errors = $stats->{overrides}{by_severity}{4} || 0;
+            my $warnings = $stats->{overrides}{by_severity}{2} || 0;
+	    $overrides{errors} += $errors;
+	    $overrides{warnings} += $warnings;
         }
     }
 
@@ -1430,6 +1421,30 @@
 	close(STATUS);
     }
 }
+if (not $quiet and not $no_override and not $show_overrides) {
+    my $errors = $overrides{errors};
+    my $warnings = $overrides{warnings};
+    my $total = $errors + $warnings;
+    if ($total > 0) {
+	my $total = ($total == 1)
+	    ? "$total tag overridden"
+	    : "$total tags overridden";
+	if ($errors) {
+	    $errors = ($errors == 1) ? "$errors error" : "$errors errors";
+	}
+	if ($warnings) {
+	    $warnings = ($warnings == 1) ? "$warnings warning" : "$warnings warnings";
+	}
+	if ($errors and $warnings) {
+	    print "N: $total ($errors, $warnings)\n";
+	} elsif ($errors) {
+	    print "N: $total ($errors)\n";
+	} elsif ($warnings) {
+	    print "N: $total ($warnings)\n";
+	}
+    }
+}
+
 # }}}
 
 # {{{ close up lintian-info pipe if needed

Modified: trunk/man/lintian.1
===================================================================
--- trunk/man/lintian.1	2008-01-05 18:57:07 UTC (rev 1117)
+++ trunk/man/lintian.1	2008-01-05 22:33:41 UTC (rev 1118)
@@ -113,21 +113,27 @@
 Display usage information and exit.
 
 .TP
+.BR \-V ", " \-\-version
+Display lintian version number and exit.
+
+.TP
+.BR \-\-print\-version
+Print unadorned version number and exit.
+
+.TP
 .BR \-v ", " \-\-verbose
 Display verbose messages.
 
 .TP
-.BR \-V ", " \-\-version
-Display lintian version number and exit.
-
-.TP
 .BR \-d ", " \-\-debug
 Display debugging messages. (Implies
 .BR \-v ).
 
 .TP
-.BR \-\-print\-version
-Print unadorned version number and exit.
+.BR \-q ", " \-\-quiet
+Suppress all informational messages.  Currently, the only message this
+suppresses is the message at the end of the run giving the total count of
+overrides.
 
 .PP
 

Modified: trunk/testset/tags.libbaz
===================================================================
--- trunk/testset/tags.libbaz	2008-01-05 18:57:07 UTC (rev 1117)
+++ trunk/testset/tags.libbaz	2008-01-05 22:33:41 UTC (rev 1118)
@@ -26,7 +26,7 @@
 I: libbaz2-dbg: no-md5sums-control-file
 I: libbaz2-dev: no-md5sums-control-file
 I: libbaz2: no-md5sums-control-file
-N: libbaz_1-1.dsc overrode 4 warnings
+N: 4 tags overridden (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: native-package-with-dash-version

Modified: trunk/testset/tags.manpages
===================================================================
--- trunk/testset/tags.manpages	2008-01-05 18:57:07 UTC (rev 1117)
+++ trunk/testset/tags.manpages	2008-01-05 22:33:41 UTC (rev 1118)
@@ -34,7 +34,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
+N: 1 tag overridden (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: