[lintian] 01/04: checks/python.pm: Move to "Type: source, binary" check type.
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit 99bc11be66dc0e3163f22566ad0811788e487c9b
Author: Chris Lamb <lamby@debian.org>
Date: Sat Sep 30 09:30:59 2017 +0100
checks/python.pm: Move to "Type: source, binary" check type.
---
checks/python.desc | 2 +-
checks/python.pm | 59 +++++++++++++++++++++------------
debian/changelog | 3 ++
t/tests/python-new-python2-package/tags | 2 +-
t/tests/python-python2-apps/tags | 10 +++---
5 files changed, 48 insertions(+), 28 deletions(-)
diff --git a/checks/python.desc b/checks/python.desc
index 4d418e2..f17d1bf 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -1,6 +1,6 @@
Check-Script: python
Author: Chris Lamb <lamby@debian.org>
-Type: source
+Type: source, binary
Info: This script checks Python-related issues
Needs-Info: unpacked, changelog-file
diff --git a/checks/python.pm b/checks/python.pm
index cd41681..bd17a9b 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -30,35 +30,27 @@ use Lintian::Tags qw(tag);
my @PYTHON2 = qw(python python2.7 python-dev);
sub run {
- my ($pkg, undef, $info) = @_;
+ my ($pkg, $type, $info) = @_;
- my @entries = $info->changelog ? $info->changelog->data : ();
- my @package_names = $info->binaries;
+ if ($type eq 'source') {
+ _run_source($pkg, $info);
+ } else {
+ _run_binary($pkg, $info);
+ }
+
+ return;
+}
+
+sub _run_source {
+ my ($pkg, $info) = @_;
+ my @package_names = $info->binaries;
foreach my $bin (@package_names) {
# Python 2 modules
if ($bin =~ /^python-(.*(?<!-doc))$/) {
my $suffix = $1;
-
tag 'python-foo-but-no-python3-foo', $bin
unless any { $_ eq "python3-${suffix}" } @package_names;
-
- tag 'new-package-should-not-package-python2-module', $bin
- if @entries == 1;
- }
-
- # Python applications
- if ($bin !~ /^python[23]?-/ and not any { $_ eq $bin } @PYTHON2) {
- for my $field (qw(Depends Pre-Depends Recommends Suggests)) {
- next unless $info->binary_field($bin, lc($field));
-
- my $relation = $info->binary_relation($bin, $field);
- for my $dep (@PYTHON2) {
- tag 'dependency-on-python-version-marked-for-end-of-life',
- "$bin ($field: $dep)"
- if $relation->implies($dep);
- }
- }
}
}
@@ -74,6 +66,31 @@ sub run {
return;
}
+sub _run_binary {
+ my ($pkg, $info) = @_;
+
+ my @entries = $info->changelog ? $info->changelog->data : ();
+
+ # Python 2 modules
+ if ($pkg =~ /^python-.*(?<!-doc)$/) {
+ tag 'new-package-should-not-package-python2-module'
+ if @entries == 1;
+ }
+
+ # Python applications
+ if ($pkg !~ /^python[23]?-/ and not any { $_ eq $pkg } @PYTHON2) {
+ for my $field (qw(Depends Pre-Depends Recommends Suggests)) {
+ for my $dep (@PYTHON2) {
+ tag 'dependency-on-python-version-marked-for-end-of-life',
+ "($field: $dep)"
+ if $info->relation($field)->implies($dep);
+ }
+ }
+ }
+
+ return;
+}
+
1;
# Local Variables:
diff --git a/debian/changelog b/debian/changelog
index 59a044b..2c5ad99 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ lintian (2.5.55) UNRELEASED; urgency=medium
"XXX: generate tag summary"
+ * checks/python.pm:
+ + [CL] Move to "Type: source, binary" check type.
+
-- Chris Lamb <lamby@debian.org> Fri, 29 Sep 2017 19:13:19 +0100
lintian (2.5.54) unstable; urgency=medium
diff --git a/t/tests/python-new-python2-package/tags b/t/tests/python-new-python2-package/tags
index 400f07a..d38b77b 100644
--- a/t/tests/python-new-python2-package/tags
+++ b/t/tests/python-new-python2-package/tags
@@ -1 +1 @@
-W: python-new-python2-package source: new-package-should-not-package-python2-module python-python-new-python2-package
+W: python-python-new-python2-package: new-package-should-not-package-python2-module
diff --git a/t/tests/python-python2-apps/tags b/t/tests/python-python2-apps/tags
index 1bbc598..81ed339 100644
--- a/t/tests/python-python2-apps/tags
+++ b/t/tests/python-python2-apps/tags
@@ -1,5 +1,5 @@
-P: python-python2-apps source: dependency-on-python-version-marked-for-end-of-life pkg-depends (Depends: python)
-P: python-python2-apps source: dependency-on-python-version-marked-for-end-of-life pkg-pre-depends (Pre-Depends: python2.7)
-P: python-python2-apps source: dependency-on-python-version-marked-for-end-of-life pkg-recommends (Recommends: python-dev)
-P: python-python2-apps source: dependency-on-python-version-marked-for-end-of-life pkg-suggests (Suggests: python)
-P: python-python2-apps source: dependency-on-python-version-marked-for-end-of-life pkg-suggests (Suggests: python2.7)
+P: pkg-depends: dependency-on-python-version-marked-for-end-of-life (Depends: python)
+P: pkg-pre-depends: dependency-on-python-version-marked-for-end-of-life (Pre-Depends: python2.7)
+P: pkg-recommends: dependency-on-python-version-marked-for-end-of-life (Recommends: python-dev)
+P: pkg-suggests: dependency-on-python-version-marked-for-end-of-life (Suggests: python)
+P: pkg-suggests: dependency-on-python-version-marked-for-end-of-life (Suggests: python2.7)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: