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

Bug#459851: lintian: outputs wrong total count of overrides



tags 459851 + patch
kthxbye

Hi Cyril,

I'm not sure this is a bug, per se. "several-sonames-in-same-package" is an
"info" tag, whilst "package-name-doesnt-match-sonames" is a "warning" tag.
Thus, you only override one ">= warning" tag.

I would agree if you claimed that this is somewhat misleading. I have
attached a patch against SVN trunk (with testcase) which makes the output
clearer when you override against a tag of "Type: info".

Against Cyril's package this outputs:

 % frontend/lintian  ~/temp/cdt.FnP10373/libgraphviz4_2.16-2_amd64.deb
 N: 1 tag overridden (1 warning, plus 1 useless override)
 %

(As a caveat: my Perl is terrible, and I may have got the explanation
completely wrong.)


Regards,

-- 
Chris Lamb, UK                                       chris@chris-lamb.co.uk
                                                            GPG: 0x634F9A20
Index: frontend/lintian
===================================================================
--- frontend/lintian	(revision 1127)
+++ frontend/lintian	(working copy)
@@ -1370,8 +1370,10 @@
             $short =~ s%.*/%%;
             my $errors = $stats->{overrides}{by_severity}{4} || 0;
             my $warnings = $stats->{overrides}{by_severity}{2} || 0;
+            my $info = $stats->{overrides}{by_severity}{0} || 0;
 	    $overrides{errors} += $errors;
 	    $overrides{warnings} += $warnings;
+	    $overrides{info} += $info;
         }
     }
 
@@ -1424,24 +1426,25 @@
 if (not $quiet and not $no_override and not $show_overrides) {
     my $errors = $overrides{errors};
     my $warnings = $overrides{warnings};
+    my $useless = $overrides{info};
     my $total = $errors + $warnings;
-    if ($total > 0) {
+    if ($total + $useless > 0) {
 	my $total = ($total == 1)
 	    ? "$total tag overridden"
 	    : "$total tags overridden";
+	my @output;
 	if ($errors) {
-	    $errors = ($errors == 1) ? "$errors error" : "$errors errors";
+	    push(@output, ($errors == 1) ? "$errors error" : "$errors errors");
 	}
 	if ($warnings) {
-	    $warnings = ($warnings == 1) ? "$warnings warning" : "$warnings warnings";
+	    push(@output, ($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";
+	if ($useless) {
+	    push(@output, "plus $useless useless override");
 	}
+	if (@output) {
+		print "N: $total (" . join(", ", @output) . ")\n";
+	}
     }
 }
 
Index: testset/tags.manpages
===================================================================
--- testset/tags.manpages	(revision 1127)
+++ testset/tags.manpages	(working copy)
@@ -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: 1 tag overridden (1 error)
+N: 1 tag overridden (1 error, plus 1 useless override)
 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
Index: testset/manpages/debian/overrides
===================================================================
--- testset/manpages/debian/overrides	(revision 1127)
+++ testset/manpages/debian/overrides	(working copy)
@@ -2,6 +2,8 @@
 foo-tag-that-does-not-exist
 # this is a valid comment
 
+# An 'info' tag:
+package-contains-empty-perl-directory
 
    
 #and some empty lines
Index: testset/manpages/debian/rules
===================================================================
--- testset/manpages/debian/rules	(revision 1127)
+++ testset/manpages/debian/rules	(working copy)
@@ -65,6 +65,9 @@
 	install -m644 foo.info $(tmp)/usr/share/info/baz.broken.gz
 	touch $(tmp)/usr/share/info/image.png
 
+	# To emit 'info' tag
+	mkdir -p $(tmp)/usr/lib/perl5
+
 	install -d $(tmp)/usr/share/doc/manpages
 	cp debian/changelog $(tmp)/usr/share/doc/manpages/changelog
 	gzip -9 $(tmp)/usr/share/doc/manpages/changelog

Attachment: signature.asc
Description: PGP signature


Reply to: