[lintian] 01/01: Warn about packages that ship Python modules but are missing dependencies on any Python interpreter. (Closes: #887083)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit 6a8184a26370c7b7996deb5394cd198c130d525f
Author: Chris Lamb <lamby@debian.org>
Date: Sun Jan 14 20:14:09 2018 +1100
Warn about packages that ship Python modules but are missing dependencies on any Python interpreter. (Closes: #887083)
---
checks/python.desc | 9 +++++++++
checks/python.pm | 10 ++++++++++
debian/changelog | 2 ++
t/tests/binaries-missing-depends-on-numpy-abi/tags | 1 +
t/tests/files-general/tags | 1 +
t/tests/files-python-module-has-overly-generic-name/tags | 1 +
t/tests/files-python-modules/tags | 1 +
t/tests/legacy-scripts/tags | 1 +
.../debian/debian/control.in | 16 ++++++++++++++++
.../debian/debian/rules | 10 ++++++++++
t/tests/python-package-missing-depends-on-python/desc | 6 ++++++
t/tests/python-package-missing-depends-on-python/tags | 1 +
12 files changed, 59 insertions(+)
diff --git a/checks/python.desc b/checks/python.desc
index 0f15677..963c8fb 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -109,3 +109,12 @@ Info: Either the specified Python 3.x package declares a dependency on a
This is likely a typo in <tt>debian/control</tt> or due to misconfigured
calls to, for example, <tt>dh_installdocs --link-doc=PKG</tt>.
Ref: #884692
+
+Tag: python-package-missing-depends-on-python
+Severity: serious
+Certainty: certain
+Info: The specified Python package ships Python modules under
+ <tt>/usr/lib</tt> but does not specify any dependency on Python.
+ .
+ This is likely an omission or the result of a typo in
+ <tt>debian/control</tt>.
diff --git a/checks/python.pm b/checks/python.pm
index 53b6a15..339b260 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -99,8 +99,18 @@ sub _run_source {
sub _run_binary {
my ($pkg, $info) = @_;
+ my $deps = Lintian::Relation->and($info->relation('all'),
+ $info->relation('provides'), $pkg);
my @entries = $info->changelog ? $info->changelog->data : ();
+ if (
+ any { m,^usr/lib/python[\d.]+/(?:site|dist)-packages, }
+ $info->sorted_index
+ and not $deps->implies('python:any | python-minimal:any')
+ ) {
+ tag 'python-package-missing-depends-on-python';
+ }
+
# Python 2 modules
if ( $pkg =~ /^python2?-/
and none { $pkg =~ /$_$/ } @IGNORE
diff --git a/debian/changelog b/debian/changelog
index 9edf766..6eb659f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,8 @@ lintian (2.5.69) UNRELEASED; urgency=medium
new-package-should-not-package-python2-module tag.
+ [CL] Include the offending package name when warning about
new-package-should-not-package-python2-module.
+ + [CL] Warn about packages that ship Python modules but are missing
+ dependencies on any Python interpreter. (Closes: #887083)
* checks/rules.pm:
+ [CL] Allow rules-not-should-not-use data-based tags to capture
variables and include them in the emitted tag.
diff --git a/t/tests/binaries-missing-depends-on-numpy-abi/tags b/t/tests/binaries-missing-depends-on-numpy-abi/tags
index 12e1d3e..30a4008 100644
--- a/t/tests/binaries-missing-depends-on-numpy-abi/tags
+++ b/t/tests/binaries-missing-depends-on-numpy-abi/tags
@@ -1 +1,2 @@
E: binaries-missing-depends-on-numpy-abi: missing-dependency-on-numpy-abi
+E: binaries-missing-depends-on-numpy-abi: python-package-missing-depends-on-python
diff --git a/t/tests/files-general/tags b/t/tests/files-general/tags
index b3907a9..8eedfef 100644
--- a/t/tests/files-general/tags
+++ b/t/tests/files-general/tags
@@ -20,6 +20,7 @@ E: files-general: package-contains-info-dir-file usr/share/info/dir.gz
E: files-general: package-contains-mime-cache-file usr/share/mime/types
E: files-general: package-contains-mimeinfo.cache-file usr/share/applications/mimeinfo.cache
E: files-general: package-modifies-ld.so-search-path etc/ld.so.conf.d/lintian-lib.conf
+E: files-general: python-package-missing-depends-on-python
E: files-general: star-file usr/share/foo/*
E: files-general: stray-directory-in-manpage-directory usr/share/man/man1/random/
I: files-general: duplicated-compressed-file usr/share/doc/lintian/lintian-16x16.png.gz
diff --git a/t/tests/files-python-module-has-overly-generic-name/tags b/t/tests/files-python-module-has-overly-generic-name/tags
index 2a48ca8..e3d0bec 100644
--- a/t/tests/files-python-module-has-overly-generic-name/tags
+++ b/t/tests/files-python-module-has-overly-generic-name/tags
@@ -6,3 +6,4 @@ E: python3-foo: python-module-has-overly-generic-name usr/lib/python3/dist-packa
E: python3-foo: python-module-has-overly-generic-name usr/lib/python3/dist-packages/test/__init__.py (test)
E: python3-foo: python-module-has-overly-generic-name usr/lib/python3/dist-packages/tests.py (tests)
E: python3-foo: python-module-has-overly-generic-name usr/lib/python3/dist-packages/tests/__init__.py (tests)
+E: python3-foo: python-package-missing-depends-on-python
diff --git a/t/tests/files-python-modules/tags b/t/tests/files-python-modules/tags
index 9e7ec4a..23c0659 100644
--- a/t/tests/files-python-modules/tags
+++ b/t/tests/files-python-modules/tags
@@ -1,3 +1,4 @@
+E: python-foo: python-package-missing-depends-on-python
W: files-python-modules source: python-foo-but-no-python3-foo python-foo
W: python-foo: python-module-in-wrong-location usr/lib/python2.5/dist-packages/python-foo usr/lib/python2.5/site-packages/python-foo
W: python-foo: python-module-in-wrong-location usr/lib/python2.6/site-packages/python-foo usr/lib/python2.6/dist-packages/python-foo
diff --git a/t/tests/legacy-scripts/tags b/t/tests/legacy-scripts/tags
index cd2b16b..aba9fdd 100644
--- a/t/tests/legacy-scripts/tags
+++ b/t/tests/legacy-scripts/tags
@@ -19,6 +19,7 @@ E: scripts: php-script-but-no-php-cli-dep usr/share/scripts/php7.0envfoo #!php7.
E: scripts: php-script-but-no-php-cli-dep usr/share/scripts/php7.0foo #!/usr/bin/php7.0
E: scripts: php-script-but-no-php-cli-dep usr/share/scripts/phpenvfoo #!php
E: scripts: php-script-but-no-php-cli-dep usr/share/scripts/phpfoo #!/usr/bin/php
+E: scripts: python-package-missing-depends-on-python
E: scripts: python-script-but-no-python-dep usr/bin/py2.Xfoo
E: scripts: python-script-but-no-python-dep usr/bin/pyfoo #!python
E: scripts: script-without-interpreter control/prerm
diff --git a/t/tests/python-package-missing-depends-on-python/debian/debian/control.in b/t/tests/python-package-missing-depends-on-python/debian/debian/control.in
new file mode 100644
index 0000000..7770901
--- /dev/null
+++ b/t/tests/python-package-missing-depends-on-python/debian/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: optional
+Section: python
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: python3-{$source}
+Architecture: all
+Depends: $\{misc:Depends\}
+Description: Python package with no Python dependencies
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
diff --git a/t/tests/python-package-missing-depends-on-python/debian/debian/rules b/t/tests/python-package-missing-depends-on-python/debian/debian/rules
new file mode 100755
index 0000000..ffbb59d
--- /dev/null
+++ b/t/tests/python-package-missing-depends-on-python/debian/debian/rules
@@ -0,0 +1,10 @@
+#!/usr/bin/make -f
+
+TARGET = debian/$(shell dh_listpackages)/usr/lib/python3/dist-packages
+
+%:
+ dh $@
+
+override_dh_auto_install:
+ mkdir -p $(TARGET)
+ touch $(TARGET)/lintian.py
diff --git a/t/tests/python-package-missing-depends-on-python/desc b/t/tests/python-package-missing-depends-on-python/desc
new file mode 100644
index 0000000..c872c1c
--- /dev/null
+++ b/t/tests/python-package-missing-depends-on-python/desc
@@ -0,0 +1,6 @@
+Testname: python-package-missing-depends-on-python
+Sequence: 6000
+Version: 1.0
+Description: Check for packages missing depends on Python
+Test-For:
+ python-package-missing-depends-on-python
diff --git a/t/tests/python-package-missing-depends-on-python/tags b/t/tests/python-package-missing-depends-on-python/tags
new file mode 100644
index 0000000..1708ecd
--- /dev/null
+++ b/t/tests/python-package-missing-depends-on-python/tags
@@ -0,0 +1 @@
+E: python3-python-package-missing-depends-on-python: python-package-missing-depends-on-python
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: