[lintian] 07/12: c/d-src-dir: Classify the declared source format
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 4ec3c9a28c0c55d34fd9053fabd2947060013624
Author: Niels Thykier <niels@thykier.net>
Date: Sun Mar 6 18:52:22 2016 +0000
c/d-src-dir: Classify the declared source format
---
checks/debian-source-dir.desc | 7 ++++++-
checks/debian-source-dir.pm | 17 +++++++++++++++--
t/tests/debhelper-compat-old/tags | 1 +
t/tests/debian-source-dir-classifications/desc | 6 ++++++
t/tests/debian-source-dir-classifications/tags | 1 +
5 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/checks/debian-source-dir.desc b/checks/debian-source-dir.desc
index 0a94b2d..512ceb9 100644
--- a/checks/debian-source-dir.desc
+++ b/checks/debian-source-dir.desc
@@ -3,7 +3,7 @@ Author: Raphaël Hertzog <hertzog@debian.org>
Abbrev: dsd
Type: source
Info: This script looks for mistakes in debian/source/* files.
-Needs-Info: unpacked
+Needs-Info: unpacked, diffstat
Tag: missing-debian-source-format
Severity: wishlist
@@ -63,3 +63,8 @@ Info: The source package contains non-empty debian/source/git-patches,
with a misconfigured gitpkg) and without manually exporting the patches.
See the above mentioned hook file (in /usr/share/gitpkg/hooks) for
information on how to manually export patches.
+
+Tag: source-format
+Severity: classification
+Certainty: certain
+Info: This is the source format declared in the package.
diff --git a/checks/debian-source-dir.pm b/checks/debian-source-dir.pm
index c9518ce..46c1d5d 100644
--- a/checks/debian-source-dir.pm
+++ b/checks/debian-source-dir.pm
@@ -36,19 +36,32 @@ our $KNOWN_FILES = Lintian::Data->new('debian-source-dir/known-files');
sub run {
my (undef, undef, $info) = @_;
my $dsrc = $info->index_resolved_path('debian/source/');
- my ($format_file, $git_pfile);
+ my ($format_file, $git_pfile, $format, $format_extra);
$format_file = $dsrc->child('format') if $dsrc;
if ($format_file and $format_file->is_open_ok) {
my $fd = $format_file->open;
- my $format = <$fd>;
+ $format = <$fd>;
chomp $format;
close($fd);
+ $format_extra = '';
tag 'unknown-source-format', $format unless $KNOWN_FORMATS{$format};
} else {
tag 'missing-debian-source-format';
+ $format = '1.0';
+ $format_extra = 'implicit';
}
+ if ($format eq '1.0') {
+ $format_extra .= ' ' if $format_extra;
+ if ($info->diffstat) {
+ $format_extra .= 'non-native';
+ } else {
+ $format_extra .= 'native';
+ }
+ }
+ $format .= " [$format_extra]" if $format_extra;
+ tag 'source-format', $format;
return if not $dsrc;
diff --git a/t/tests/debhelper-compat-old/tags b/t/tests/debhelper-compat-old/tags
index caf93d0..d88995d 100644
--- a/t/tests/debhelper-compat-old/tags
+++ b/t/tests/debhelper-compat-old/tags
@@ -1,2 +1,3 @@
C: debhelper-compat-old source: debian-build-system dh
+C: debhelper-compat-old source: source-format 1.0 [non-native]
P: debhelper-compat-old source: package-uses-old-debhelper-compat-version 8
diff --git a/t/tests/debian-source-dir-classifications/desc b/t/tests/debian-source-dir-classifications/desc
new file mode 100644
index 0000000..5c858a6
--- /dev/null
+++ b/t/tests/debian-source-dir-classifications/desc
@@ -0,0 +1,6 @@
+Testname: debian-source-dir-classifications
+Sequence: 6000
+Version: 1.0
+Options: -L +classification -C debian-source-dir
+Description: Test for d-s-d classifications tags
+Test-For: source-format
diff --git a/t/tests/debian-source-dir-classifications/tags b/t/tests/debian-source-dir-classifications/tags
new file mode 100644
index 0000000..7508799
--- /dev/null
+++ b/t/tests/debian-source-dir-classifications/tags
@@ -0,0 +1 @@
+C: debian-source-dir-classifications source: source-format 1.0 [non-native]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: