[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: Check for binary packages that depend on Python 2.x. (Closes: #870822)



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit dcfcc9caccfce40e14e8cb38eb09408dd4a03332
Author: Chris Lamb <lamby@debian.org>
Date:   Sat Aug 5 09:50:19 2017 -0400

    Check for binary packages that depend on Python 2.x. (Closes: #870822)
---
 checks/python.desc                                 |  9 +++
 checks/python.pm                                   | 18 +++++-
 debian/changelog                                   |  2 +
 .../python-python2-apps/debian/debian/control.in   | 75 ++++++++++++++++++++++
 t/tests/python-python2-apps/desc                   |  6 ++
 t/tests/python-python2-apps/tags                   |  5 ++
 t/tests/scripts-interpreters/tags                  |  1 +
 7 files changed, 115 insertions(+), 1 deletion(-)

diff --git a/checks/python.desc b/checks/python.desc
index ebaefc1..4d418e2 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -51,3 +51,12 @@ Info: This package alternatively Build-Depends on the Python 2 or Python 3
  .
  Please replace the alternative with a single build dependency on
  <tt>python3-sphinx</tt>.
+
+Tag: dependency-on-python-version-marked-for-end-of-life
+Severity: pedantic
+Certainty: certain
+Ref: https://wiki.debian.org/Python/Python3Port, https://www.python.org/dev/peps/pep-0373/
+Info: The package specifies a dependency on Python 2.x which is due for
+ deprecation and will not be maintained past 2020.
+ .
+ Please port the package to use Python 3 instead.
diff --git a/checks/python.pm b/checks/python.pm
index ad0a10b..cd41681 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -27,6 +27,8 @@ use List::MoreUtils qw(any);
 
 use Lintian::Tags qw(tag);
 
+my @PYTHON2 = qw(python python2.7 python-dev);
+
 sub run {
     my ($pkg, undef, $info) = @_;
 
@@ -34,7 +36,7 @@ sub run {
     my @package_names = $info->binaries;
 
     foreach my $bin (@package_names) {
-        # Python 2 packages
+        # Python 2 modules
         if ($bin =~ /^python-(.*(?<!-doc))$/) {
             my $suffix = $1;
 
@@ -44,6 +46,20 @@ sub run {
             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);
+                }
+            }
+        }
     }
 
     my $build_all = $info->relation('build-depends-all');
diff --git a/debian/changelog b/debian/changelog
index dc27062..855c69d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,8 @@ lintian (2.5.53) UNRELEASED; urgency=medium
       (Closes: #870730)
     + [CL] Check for packages that alternatively Build-Depend on the
       Python 2 and Python 3 versions of Sphinx.  (Closes: #870758)
+    + [CL] Check for binary packages that depend on Python 2.x.
+      (Closes: #870822)
   * checks/scripts.pm:
     + [CL] Correct false positives in
       unconditional-use-of-dpkg-statoverride by detecting "if !" as a
diff --git a/t/tests/python-python2-apps/debian/debian/control.in b/t/tests/python-python2-apps/debian/debian/control.in
new file mode 100644
index 0000000..5238337
--- /dev/null
+++ b/t/tests/python-python2-apps/debian/debian/control.in
@@ -0,0 +1,75 @@
+Source: {$source}
+Priority: extra
+Section: python
+Maintainer: {$author}
+Build-Depends: {$build_depends}
+Standards-Version: {$standards_version}
+
+Package: pkg-depends
+Architecture: all
+Depends: $\{misc:Depends\}, python
+Description: Test package with Python 2.x in Depends
+ 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.
+ .
+ Description: Test package with Python 2.x in Depends.
+
+Package: pkg-pre-depends
+Architecture: all
+Depends: $\{misc:Depends\}
+Pre-Depends: python2.7
+Description: Test package with Python 2.x in Pre-Suggests
+ 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.
+ .
+ Description: Test package with Python 2.x in Pre-Depends.
+
+Package: pkg-recommends
+Architecture: all
+Depends: $\{misc:Depends\}
+Recommends: python-dev
+Description: Test package with Python 2.x in Recommends
+ 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.
+ .
+ Description: Test package with Python 2.x in Recommends.
+
+Package: pkg-suggests
+Architecture: all
+Depends: $\{misc:Depends\}
+Suggests: python, python2.7
+Description: Test package with Python 2.x in Suggests
+ 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.
+ .
+ Description: Test package with Python 2.x in Suggests.
+
+Package: python-{$source}
+Architecture: all
+Depends: $\{misc:Depends\}, python
+Description: Python 3 module with Python 3.x in Depends
+ 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 module with Python 2.x in Depends.
+
+Package: python3-{$source}
+Architecture: all
+Depends: $\{misc:Depends\}, python3
+Description: Test package (Python 3)
+ 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 module with Python 3.x in Depends.
diff --git a/t/tests/python-python2-apps/desc b/t/tests/python-python2-apps/desc
new file mode 100644
index 0000000..ffac0ba
--- /dev/null
+++ b/t/tests/python-python2-apps/desc
@@ -0,0 +1,6 @@
+Testname: python-python2-apps
+Version: 1.0
+Description: Check packages that Depend/Suggest etc. on Python 2.x
+Options: -I -E --pedantic
+Test-For:
+ dependency-on-python-version-marked-for-end-of-life
diff --git a/t/tests/python-python2-apps/tags b/t/tests/python-python2-apps/tags
new file mode 100644
index 0000000..1bbc598
--- /dev/null
+++ b/t/tests/python-python2-apps/tags
@@ -0,0 +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)
diff --git a/t/tests/scripts-interpreters/tags b/t/tests/scripts-interpreters/tags
index fdb4b99..d301aad 100644
--- a/t/tests/scripts-interpreters/tags
+++ b/t/tests/scripts-interpreters/tags
@@ -10,6 +10,7 @@ I: scripts-interpreters: example-script-uses-bin-env usr/share/doc/scripts-inter
 I: scripts-interpreters: example-script-without-interpreter usr/share/doc/scripts-interpreters/examples/no-interpreter
 I: scripts-interpreters: example-wrong-path-for-interpreter usr/share/doc/scripts-interpreters/examples/not-absolute (#!perl != /usr/bin/perl)
 I: scripts-interpreters: example-wrong-path-for-interpreter usr/share/doc/scripts-interpreters/examples/wrong-perl-path (#!/bin/perl != /usr/bin/perl)
+P: scripts-interpreters source: dependency-on-python-version-marked-for-end-of-life scripts-interpreters (Depends: python2.7)
 P: scripts-interpreters: example-interpreter-in-usr-local usr/share/doc/scripts-interpreters/examples/usr-local #!/usr/local/bin/special-perl
 P: scripts-interpreters: example-shell-script-fails-syntax-check usr/share/doc/scripts-interpreters/examples/syntax
 P: scripts-interpreters: example-unusual-interpreter usr/share/doc/scripts-interpreters/examples/unusual #!/usr/bin/lintian

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: