[lintian] 02/02: Print line in case of error
This is an automated email from the git hooks/post-receive script.
broucaries-guest pushed a commit to branch master
in repository lintian.
commit 8fa1c37c10a65a8122188b3c163d533fcf7715d3
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date: Sun Sep 7 14:41:06 2014 +0200
Print line in case of error
Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
checks/testsuite.pm | 38 ++++++++++++++++++++++++--------------
debian/changelog | 1 +
t/tests/testsuite-general/tags | 14 +++++++-------
3 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/checks/testsuite.pm b/checks/testsuite.pm
index e6265b2..1700b02 100644
--- a/checks/testsuite.pm
+++ b/checks/testsuite.pm
@@ -93,46 +93,53 @@ sub check_control_contents {
my ($info, $path) = @_;
my @paragraphs;
- if (not eval { @paragraphs = read_dpkg_control($path); }) {
+ my @lines = ();
+ if (not eval { @paragraphs = read_dpkg_control($path, 0, \@lines); }) {
chomp $@;
$@ =~ s/^syntax error at //;
tag 'syntax-error-in-debian-tests-control', $@;
} else {
- for my $paragraph (@paragraphs) {
- check_control_paragraph($info, $paragraph);
+ while (my ($index, $paragraph) = each(@paragraphs)) {
+ check_control_paragraph($info, $paragraph,
+ $lines[$index]->{'START-OF-PARAGRAPH'});
}
}
return;
}
sub check_control_paragraph {
- my ($info, $paragraph) = @_;
+ my ($info, $paragraph, $line) = @_;
for my $fieldname (@MANDATORY_FIELDS) {
if (not exists $paragraph->{$fieldname}) {
- tag 'missing-runtime-tests-field', $fieldname;
+ tag 'missing-runtime-tests-field', $fieldname,
+ 'paragraph starting at line', $line;
}
}
unless (exists $paragraph->{'tests'}
|| exists $paragraph->{'test-command'}) {
- tag 'missing-runtime-tests-field', 'tests || test-command';
+ tag 'missing-runtime-tests-field', 'tests || test-command',
+ 'paragraph starting at line', $line;
}
if ( exists $paragraph->{'tests'}
&& exists $paragraph->{'test-command'}) {
- tag 'exclusive-runtime-tests-field', 'tests, test-command';
+ tag 'exclusive-runtime-tests-field', 'tests, test-command',
+ 'paragraph starting at line', $line;
}
for my $fieldname (sort(keys(%{$paragraph}))) {
if (not exists $KNOWN_FIELDS{$fieldname}) {
- tag 'unknown-runtime-tests-field', $fieldname;
+ tag 'unknown-runtime-tests-field', $fieldname,
+ 'paragraph starting at line', $line;
}
}
if (exists $paragraph->{'features'}) {
for my $feature (split(' ', $paragraph->{'features'})) {
if (not exists $KNOWN_FEATURES{$feature}) {
- tag 'unknown-runtime-tests-feature', $feature;
+ tag 'unknown-runtime-tests-feature', $feature,
+ 'paragraph starting at line', $line;
}
}
}
@@ -140,7 +147,8 @@ sub check_control_paragraph {
if (exists $paragraph->{'restrictions'}) {
for my $restriction (split ' ', $paragraph->{'restrictions'}) {
if (not exists $KNOWN_RESTRICTIONS{$restriction}) {
- tag 'unknown-runtime-tests-restriction', $restriction;
+ tag 'unknown-runtime-tests-restriction', $restriction,
+ 'paragraph starting at line', $line;
}
}
}
@@ -151,22 +159,24 @@ sub check_control_paragraph {
$directory = $paragraph->{'tests-directory'};
}
for my $testname (split(' ', $paragraph->{'tests'})) {
- check_test_file($info, $directory, $testname);
+ check_test_file($info, $directory, $testname, $line);
}
}
return;
}
sub check_test_file {
- my ($info, $directory, $name) = @_;
+ my ($info, $directory, $name, $line) = @_;
my $path = "$directory/$name";
my $index = $info->index($path);
if ($name !~ m{^ [ [:alnum:] \+ \- \. / ]++ $}xsm) {
- tag 'illegal-runtime-test-name', $name;
+ tag 'illegal-runtime-test-name', $name,
+ 'paragraph starting at line', $line;
}
if (not defined($index)) {
- tag 'missing-runtime-test-file', $path;
+ tag 'missing-runtime-test-file', $path,
+ 'paragraph starting at line', $line;
} elsif (not $index->is_regular_file) {
tag 'runtime-test-file-is-not-a-regular-file', $path;
}
diff --git a/debian/changelog b/debian/changelog
index cb93927..d85ee75 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ lintian (2.5.27) UNRELEASED; urgency=medium
* checks/testsuite.{desc,pm}:
+ [BR] Fix false positive missing-runtime-tests-field.
(Closes: #760714).
+ + [BR] Print line in case of error.
* data/fields/metapackages:
+ [BR] Add qt4-default and qt5-default as metapackage.
diff --git a/t/tests/testsuite-general/tags b/t/tests/testsuite-general/tags
index 7d41799..c537b70 100644
--- a/t/tests/testsuite-general/tags
+++ b/t/tests/testsuite-general/tags
@@ -1,9 +1,9 @@
I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/fifo
-P: testsuite-general source: unknown-runtime-tests-feature unknownfeature
-P: testsuite-general source: unknown-runtime-tests-field comment
-P: testsuite-general source: unknown-runtime-tests-restriction unknownrestriction
+P: testsuite-general source: unknown-runtime-tests-feature unknownfeature paragraph starting at line 24
+P: testsuite-general source: unknown-runtime-tests-field comment paragraph starting at line 1
+P: testsuite-general source: unknown-runtime-tests-restriction unknownrestriction paragraph starting at line 24
W: testsuite-general source: debian-tests-control-uses-national-encoding at line 2
-W: testsuite-general source: exclusive-runtime-tests-field tests, test-command
-W: testsuite-general source: illegal-runtime-test-name under_score
-W: testsuite-general source: missing-runtime-test-file debian/tests/missing-test
-W: testsuite-general source: missing-runtime-tests-field tests || test-command
+W: testsuite-general source: exclusive-runtime-tests-field tests, test-command paragraph starting at line 20
+W: testsuite-general source: illegal-runtime-test-name under_score paragraph starting at line 5
+W: testsuite-general source: missing-runtime-test-file debian/tests/missing-test paragraph starting at line 5
+W: testsuite-general source: missing-runtime-tests-field tests || test-command paragraph starting at line 24
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: