[lintian] 02/02: [CL] Warn about Python 3.x packages that depend on the Python 2.x variants of themselves (and vice versa). (Closes: #884692)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit bee9236369b5e6eea8873cdb3b5396230a872047
Author: Chris Lamb <lamby@debian.org>
Date: Fri Dec 22 16:19:02 2017 +0000
[CL] Warn about Python 3.x packages that depend on the Python 2.x variants of themselves (and vice versa). (Closes: #884692)
---
checks/python.desc | 11 +++++++
checks/python.pm | 15 +++++++++
debian/changelog | 2 ++
.../debian/debian/control.in | 38 ++++++++++++++++++++++
.../desc | 6 ++++
.../tags | 4 +++
6 files changed, 76 insertions(+)
diff --git a/checks/python.desc b/checks/python.desc
index bab9281..38075b0 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -89,3 +89,14 @@ Info: The specified package declares a dependency on <tt>${python:Depends}</tt>
<tt>${python3:Depends}</tt> when it appears to be a package for Python 2.x.
.
Please adjust the substvar to match the intended Python version.
+
+Tag: python-package-depends-on-variant-of-itself
+Severity: normal
+Certainty: certain
+Info: Either the specified Python 3.x package declares a dependency on the
+ Python 2.x version of itself, or specified Python 2.x package depends on
+ the the Python 3.x version of itself.
+ .
+ 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
diff --git a/checks/python.pm b/checks/python.pm
index f33b02b..7899d92 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -112,6 +112,21 @@ sub _run_binary {
if not $info->relation('strong')->implies($version);
}
+ if ($pkg =~ /^python([23]?)-(.*)(?<!-doc)$/) {
+ my $version = $1 // '2'; # Assume python-foo is a Python 2.x package
+ my @candidates
+ = ($version eq '2')
+ ? ("python3-$2")
+ : ("python-$2", "python2-$2");
+ for my $field (@FIELDS) {
+ for my $other (@candidates) {
+ tag 'python-package-depends-on-variant-of-itself',
+ "($field: $other)"
+ if $info->relation($field)->implies("$other:any");
+ }
+ }
+ }
+
return;
}
diff --git a/debian/changelog b/debian/changelog
index 0381849..55c4093 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,8 @@ lintian (2.5.66) UNRELEASED; urgency=medium
Python 3.x packages using ${python:Depends}. Thanks to Mattia
Rizzolo for the idea. (Closes: #884676)
+ [CL] Factor out definition of dependency fields.
+ + [CL] Warn about Python 3.x packages that depend on the Python 2.x
+ variants of themselves (and vice versa). (Closes: #884692)
* checks/rules.{desc,pm}:
+ [CL] Check for override_dh_clean targets that are missing calls to
dh_clean. Thanks to Andreas Beckmann for the idea. (Closes: #884817)
diff --git a/t/tests/python-package-depends-on-variant-of-itself/debian/debian/control.in b/t/tests/python-package-depends-on-variant-of-itself/debian/debian/control.in
new file mode 100644
index 0000000..eb1ed37
--- /dev/null
+++ b/t/tests/python-package-depends-on-variant-of-itself/debian/debian/control.in
@@ -0,0 +1,38 @@
+Source: {$source}
+Priority: optional
+Section: python
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: python-foo
+Architecture: all
+Depends: $\{misc:Depends\}, python2.7, python3-foo
+Description: Python 2 package depending on python3-foo
+ 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.
+
+Package: python2-foo
+Architecture: all
+Depends: $\{misc:Depends\}, python2.7, python3-foo
+Description: Python 2 package depending on python3-foo (explicit)
+ 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.
+ .
+ Explicit Python 2.x variant.
+
+Package: python3-foo
+Architecture: all
+Depends: $\{misc:Depends\}, python3, python-foo, python2-foo
+Description: Python 3 package depending on python-foo and python2-foo
+ 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.
+ .
+ Python 3 variant.
diff --git a/t/tests/python-package-depends-on-variant-of-itself/desc b/t/tests/python-package-depends-on-variant-of-itself/desc
new file mode 100644
index 0000000..228da85
--- /dev/null
+++ b/t/tests/python-package-depends-on-variant-of-itself/desc
@@ -0,0 +1,6 @@
+Testname: python-package-depends-on-variant-of-itself
+Sequence: 6000
+Version: 1.0
+Description: Check for Python packages that depend on variants of themselves
+Test-For:
+ python-package-depends-on-variant-of-itself
diff --git a/t/tests/python-package-depends-on-variant-of-itself/tags b/t/tests/python-package-depends-on-variant-of-itself/tags
new file mode 100644
index 0000000..5333085
--- /dev/null
+++ b/t/tests/python-package-depends-on-variant-of-itself/tags
@@ -0,0 +1,4 @@
+W: python-package-depends-on-variant-of-itself source: intra-source-package-circular-dependency python-foo python2-foo python3-foo
+W: python2-foo: python-package-depends-on-variant-of-itself (Depends: python3-foo)
+W: python3-foo: python-package-depends-on-variant-of-itself (Depends: python-foo)
+W: python3-foo: python-package-depends-on-variant-of-itself (Depends: python2-foo)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: