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

[SCM] Debian package checker branch, master, updated. 2.2.18-5-g9518612



The following commit has been merged in the master branch:
commit 9518612636d8ac6117a817c3e098ef79fe1678ac
Author: Russ Allbery <rra@debian.org>
Date:   Sun Dec 20 13:57:50 2009 -0800

    Add --suppress-tags and --suppress-tags-from-file
    
    * frontend/lintian:
      + [RA] Add options --suppress-tags and --suppress-tags-from-file to
        completely suppress the given tags.
    * lib/Tags.pm:
      + [RA] Support suppressing a list of tags.
    * man/lintian.1:
      + [RA] Document --suppress-tags and --suppress-tags-from-file.

diff --git a/debian/changelog b/debian/changelog
index 8ddc842..109ab5e 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,16 @@ lintian (2.2.19) UNRELEASED; urgency=low
       all of the descriptive text is included.  Thanks, Jonathan Wiltshire.
       (Closes: #557786)
 
+  * frontend/lintian:
+    + [RA] Add options --suppress-tags and --suppress-tags-from-file to
+      completely suppress the given tags.
+
+  * lib/Tags.pm:
+    + [RA] Support suppressing a list of tags.
+
+  * man/lintian.1:
+    + [RA] Document --suppress-tags and --suppress-tags-from-file.
+
   * t/runtests:
     + [RA] Unwrap the Options field so that it can be continued.
     + [RA] Replace TESTSET in Options with the root of the test suite so
diff --git a/frontend/lintian b/frontend/lintian
index 154d4ca..e64400c 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -72,6 +72,7 @@ my @severities = qw(wishlist minor normal important serious);
 my @certainties = qw(wild-guess possible certain);
 my %display_level = ();
 my %display_source = ();
+my %suppress_tags = ();
 
 my $schedule;
 
@@ -152,6 +153,8 @@ Behaviour options:
     --pedantic                display "P:" tags (normally suppressed)
     -L, --display-level       display tags with the specified level
     --display-source X        restrict displayed tags by source
+    --suppress-tags T,...     don\'t show the specified tags
+    --suppress-tags-from-file X don\'t show the tags listed in file X
     -l X, --unpack-level X    set default unpack level to X
     -o, --no-override         ignore overrides
     --show-overrides          output tags that have been overriden
@@ -246,6 +249,30 @@ sub record_check_tags_from_file {
     record_check_tags($_[0], $tags);
 }
 
+# Record tags that should be suppressed.
+# Options: --suppress-tags
+sub record_suppress_tags {
+    my ($option, $tags) = @_;
+    for my $tag (split(/\s*,\s*/, $tags)) {
+	$suppress_tags{$tag} = 1;
+    }
+}
+
+# Record tags that should be suppressed from a file.
+# Options: --suppress-tags-from-file
+sub record_suppress_tags_from_file {
+    my ($option, $name) = @_;
+    open (my $file, '<', $name)
+	or fail("failed to open $name: $!");
+    for my $line (<$file>) {
+	$line =~ s/^\s+//;
+	$line =~ s/\s+$//;
+	next unless $line;
+	next if $line =~ /^\#/;
+	record_suppress_tags($option, $line);
+    }
+    close $file;
+}
 
 # Record Parts requested not to check
 # Options: -X|--dont-check-part X
@@ -423,6 +450,8 @@ my %opthash = (			# ------------------ actions
 	       "pedantic" => \$display_pedantictags,
 	       "display-level|L=s" => \&record_display_level,
 	       "display-source=s" => \&record_display_source,
+	       "suppress-tags=s" => \&record_suppress_tags,
+	       "suppress-tags-from-file=s" => \&record_suppress_tags_from_file,
 	       "unpack-level|l=i" => \$unpack_level,
 	       "no-override|o" => \$no_override,
 	       "show-overrides" => \$show_overrides,
@@ -707,6 +736,7 @@ $Tags::show_overrides = $show_overrides;
 %Tags::display_source = %display_source;
 %Tags::only_issue_tags = map { $_ => 1 } (split(/,/, $check_tags))
     if defined $check_tags;
+%Tags::suppress_tags = %suppress_tags;
 use warnings;
 
 # }}}
diff --git a/lib/Tags.pm b/lib/Tags.pm
index ff6fa05..0053938 100644
--- a/lib/Tags.pm
+++ b/lib/Tags.pm
@@ -36,6 +36,7 @@ our $show_overrides = 0;
 our %display_level;
 our %display_source;
 our %only_issue_tags;
+our %suppress_tags;
 
 # The master hash with all tag info. Key is the tag name, value another hash
 # with the following keys:
@@ -361,6 +362,7 @@ sub tag {
 
     return 0 unless
 	! keys %only_issue_tags or exists $only_issue_tags{$tag};
+    return 0 if $suppress_tags{$tag};
 
     # Clean up @information and collapse it to a string.  Lintian code doesn't
     # treat the distinction between extra arguments to tag() as significant,
diff --git a/man/lintian.1 b/man/lintian.1
index 68d8040..915f318 100644
--- a/man/lintian.1
+++ b/man/lintian.1
@@ -88,7 +88,7 @@ name of the check script or the abbreviation.
 For details, see the CHECKS section below.
 
 .TP
-.BR \-T " tag1,tag2,...m " \-\-tags " tag1,tag2,..."
+.BR \-T " tag1,tag2,..., " \-\-tags " tag1,tag2,..."
 Run only the checks that issue the requested tags.  The tests for
 other tags within the check scripts will be run but the tags will
 not be issued.
@@ -194,6 +194,19 @@ both (S/C).  The default settings are equivalent to
 .BR \-L " \(dq>=important\(dq " \-L " \(dq+>=normal/possible\(dq " \-L " +minor/certain)."
 
 .TP
+.BR \-\-suppress\-tags " tag1,tag2,..."
+Suppress the listed tags.  They will not be reported if they occur and
+will not affect the exit status of Lintian.
+
+.TP
+.BR \-\-suppress\-tags\-from\-file " file"
+Suppress all tags listed in the given file.  Blank lines and lines
+beginning with # are ignored.  All other lines are taken to be tag names
+or comma-separated lists of tags to suppress.  The suppressed tags will
+not be reported if they occur and will not affect the exit status of
+Lintian.
+
+.TP
 .BR \-l " n, " \-\-unpack\-level " n"
 Set unpack level to
 .IR n .
diff --git a/t/tests/lintian-suppress-tags/debian/debian/control.in b/t/tests/lintian-suppress-tags/debian/debian/control.in
new file mode 100644
index 0000000..1bae287
--- /dev/null
+++ b/t/tests/lintian-suppress-tags/debian/debian/control.in
@@ -0,0 +1,11 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~)
+
+Package: {$srcpkg}
+Section: unknown
+Architecture: {$architecture}
+Description: {$description}
diff --git a/t/tests/lintian-suppress-tags/desc b/t/tests/lintian-suppress-tags/desc
new file mode 100644
index 0000000..0806fb1
--- /dev/null
+++ b/t/tests/lintian-suppress-tags/desc
@@ -0,0 +1,6 @@
+Testname: lintian-suppress-tags
+Sequence: 2500
+Version: 1.0
+Description: Test tag suppression
+Options: --suppress-tags extended-description-is-empty
+ --suppress-tags-from-file TESTSET/tests/lintian-suppress-tags/suppress
diff --git a/t/tests/lintian-suppress-tags/suppress b/t/tests/lintian-suppress-tags/suppress
new file mode 100644
index 0000000..70e4b19
--- /dev/null
+++ b/t/tests/lintian-suppress-tags/suppress
@@ -0,0 +1,7 @@
+# This is a comment.
+
+# Suppress a tag not present in the test.
+malformed-override
+
+# Suppress two tags on the same line.
+section-is-dh_make-template,debhelper-but-no-misc-depends
diff --git a/t/debs/deb-format-record-size/tags b/t/tests/lintian-suppress-tags/tags
similarity index 100%
copy from t/debs/deb-format-record-size/tags
copy to t/tests/lintian-suppress-tags/tags

-- 
Debian package checker


Reply to: