[SCM] Debian package checker branch, master, updated. 2.2.18-7-g26ec7c8
The following commit has been merged in the master branch:
commit b1aec6fee9de8236d889c5d1bebbac69935aefa2
Author: Russ Allbery <rra@debian.org>
Date: Sun Dec 20 14:20:20 2009 -0800
Support comments and blank lines with --tags-from-file
* frontend/lintian:
+ [RA] Support comments and blank lines in --tags-from-file files.
* man/lintian.1:
+ [RA] Document format of --tags-from-file.
diff --git a/debian/changelog b/debian/changelog
index 109ab5e..04ad1f9 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,12 +14,14 @@ lintian (2.2.19) UNRELEASED; urgency=low
* frontend/lintian:
+ [RA] Add options --suppress-tags and --suppress-tags-from-file to
completely suppress the given tags.
+ + [RA] Support comments and blank lines in --tags-from-file files.
* lib/Tags.pm:
+ [RA] Support suppressing a list of tags.
* man/lintian.1:
+ [RA] Document --suppress-tags and --suppress-tags-from-file.
+ + [RA] Document format of --tags-from-file.
* t/runtests:
+ [RA] Unwrap the Options field so that it can be continued.
diff --git a/frontend/lintian b/frontend/lintian
index e64400c..dc0fc21 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -241,12 +241,19 @@ sub record_check_tags {
# Record Parts requested for checking
# Options: --tags-from-file
sub record_check_tags_from_file {
- open my $file, '<', $_[1]
- or fail("failed to open $_[1]: $!");
- my $tags = join(',', map { chomp($_); $_ } <$file>);
+ my ($option, $name) = @_;
+ open(my $file, '<', $name)
+ or fail("failed to open $name: $!");
+ my @tags;
+ for my $line (<$file>) {
+ $line =~ s/^\s+//;
+ $line =~ s/\s+$//;
+ next unless $line;
+ next if $line =~ /^\#/;
+ push(@tags, split(/\s*,\s*/, $line));
+ }
close $file;
-
- record_check_tags($_[0], $tags);
+ record_check_tags($option, join(',', @tags));
}
# Record tags that should be suppressed.
@@ -262,7 +269,7 @@ sub record_suppress_tags {
# Options: --suppress-tags-from-file
sub record_suppress_tags_from_file {
my ($option, $name) = @_;
- open (my $file, '<', $name)
+ open(my $file, '<', $name)
or fail("failed to open $name: $!");
for my $line (<$file>) {
$line =~ s/^\s+//;
diff --git a/man/lintian.1 b/man/lintian.1
index 915f318..bded6bf 100644
--- a/man/lintian.1
+++ b/man/lintian.1
@@ -97,7 +97,9 @@ not be issued.
.BR \-\-tags\-from\-file " filename"
Same functionality as
.BR \-\-tags ,
-but read the list of tags from a file, one per line.
+but read the list of tags from a file. Blank lines and lines beginning
+with # are ignored. All other lines are taken to be tag names or
+comma-separated lists of tag names to suppress.
.TP
.BR \-X " chk1,chk2,..., " \-\-dont\-check\-part " chk1,chk2,..."
@@ -202,8 +204,8 @@ will not affect the exit status of Lintian.
.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
+or comma-separated lists of tag nams to suppress. The suppressed tags
+will not be reported if they occur and will not affect the exit status of
Lintian.
.TP
diff --git a/t/tests/lintian-suppress-tags/debian/debian/control.in b/t/tests/lintian-check-tags-file/debian/debian/control.in
similarity index 100%
copy from t/tests/lintian-suppress-tags/debian/debian/control.in
copy to t/tests/lintian-check-tags-file/debian/debian/control.in
diff --git a/t/tests/lintian-check-tags-file/desc b/t/tests/lintian-check-tags-file/desc
new file mode 100644
index 0000000..2b0a8cd
--- /dev/null
+++ b/t/tests/lintian-check-tags-file/desc
@@ -0,0 +1,5 @@
+Testname: lintian-check-tags-file
+Sequence: 2500
+Version: 1.0
+Description: Test checking a specific list of tags from a file
+Options: --tags-from-file TESTSET/tests/lintian-check-tags-file/tag-list
diff --git a/t/tests/lintian-check-tags-file/tag-list b/t/tests/lintian-check-tags-file/tag-list
new file mode 100644
index 0000000..2b96cbf
--- /dev/null
+++ b/t/tests/lintian-check-tags-file/tag-list
@@ -0,0 +1,7 @@
+# This is a comment.
+
+# Check a couple of tags that we issue
+section-is-dh_make-template, debhelper-but-no-misc-depends
+
+# Check some other tag that we don't issue
+ malformed-override
diff --git a/t/tests/lintian-check-tags-file/tags b/t/tests/lintian-check-tags-file/tags
new file mode 100644
index 0000000..35c6abe
--- /dev/null
+++ b/t/tests/lintian-check-tags-file/tags
@@ -0,0 +1,2 @@
+E: lintian-check-tags-file: section-is-dh_make-template
+W: lintian-check-tags-file source: debhelper-but-no-misc-depends lintian-check-tags-file
--
Debian package checker
Reply to: