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

[lintian] 02/02: Check for python-foo without corresponding python3-foo packages to assist in Python 2.x deprecation. (Closes: #870681)



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

lamby pushed a commit to branch master
in repository lintian.

commit 3ceb503acd997708592bdf0f3065fbd6253cc234
Author: Chris Lamb <lamby@debian.org>
Date:   Thu Aug 3 22:04:52 2017 -0400

    Check for python-foo without corresponding python3-foo packages to assist in Python 2.x deprecation. (Closes: #870681)
---
 checks/python.desc                              |  9 ++++++++
 checks/python.pm                                |  9 +++++++-
 debian/changelog                                |  2 ++
 t/tests/python-python2/debian/debian/control.in | 28 +++++++++++++++++++++++--
 t/tests/python-python2/desc                     |  1 +
 t/tests/python-python2/tags                     |  4 +++-
 6 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/checks/python.desc b/checks/python.desc
index c5030fa..1d9c83d 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -17,3 +17,12 @@ Info: This package appears to be the initial packaging of a new upstream
  .
  This warning can be ignored if the package is not intended for Debian or
  if it is a split of an existing Debian package.
+
+Tag: python-foo-but-no-python3-foo
+Severity: wishlist
+Certainty: certain
+Info: This package appears to generate a Python 2 module without a
+ corresponding Python 3 version.
+ .
+ The 2.x series of Python is due for deprecation and will not be maintained
+ past 2020.
diff --git a/checks/python.pm b/checks/python.pm
index 15d7acd..ba2c567 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -23,6 +23,8 @@ use strict;
 use warnings;
 use autodie;
 
+use List::MoreUtils qw(any);
+
 use Lintian::Tags qw(tag);
 
 sub run {
@@ -33,7 +35,12 @@ sub run {
 
     foreach my $bin (@package_names) {
         # Python 2 packages
-        if ($bin =~ /^python-.*(?<!-doc)$/) {
+        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;
         }
diff --git a/debian/changelog b/debian/changelog
index 3cc48f9..b275ada 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,8 @@ lintian (2.5.53) UNRELEASED; urgency=medium
   * checks/python.{pm,desc}:
     + [CL] Split out Python checks from "scripts" check to a new, source
       check of type "source".
+    + [CL] Check for python-foo without corresponding python3-foo packages
+      to assist in Python 2.x deprecation.  (Closes: #870681)
   * 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/debian/debian/control.in b/t/tests/python-python2/debian/debian/control.in
index 993dee7..acf55c7 100644
--- a/t/tests/python-python2/debian/debian/control.in
+++ b/t/tests/python-python2/debian/debian/control.in
@@ -5,11 +5,35 @@ Maintainer: {$author}
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 9)
 
-Package: python-{$source}
+Package: python-{$source}-nopy3
 Architecture: all
 Depends: $\{misc:Depends\}, python2.7
-Description: {$description}
+Description: Python 2 package with no corresponding Python 3 package
  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.
+ .
+ This is a Python 2 package with no corresponding Python 3 package.
+
+Package: python-{$source}-withpy3
+Architecture: all
+Depends: $\{misc:Depends\}, python2.7
+Description: Python 2 package with corresponding Python 3 package
+ 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.
+ .
+ This is a Python 2 package with corresponding Python 3 package.
+
+Package: python3-{$source}-withpy3
+Architecture: all
+Depends: $\{misc:Depends\}, python3
+Description: Python 3 package with corresponding Python 2 package
+ 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.
+ .
+ This is a Python 3 package with corresponding Python 2 package.
diff --git a/t/tests/python-python2/desc b/t/tests/python-python2/desc
index 4f797e7..a0e09a7 100644
--- a/t/tests/python-python2/desc
+++ b/t/tests/python-python2/desc
@@ -6,3 +6,4 @@ Skeleton: pedantic
 Options: --pedantic -I -E
 Test-For:
  new-package-should-not-package-python2-module
+ python-foo-but-no-python3-foo
diff --git a/t/tests/python-python2/tags b/t/tests/python-python2/tags
index dea44ce..ef91ce0 100644
--- a/t/tests/python-python2/tags
+++ b/t/tests/python-python2/tags
@@ -1 +1,3 @@
-W: python-python2 source: new-package-should-not-package-python2-module python-python-python2
+I: python-python2 source: python-foo-but-no-python3-foo python-python-python2-nopy3
+W: python-python2 source: new-package-should-not-package-python2-module python-python-python2-nopy3
+W: python-python2 source: new-package-should-not-package-python2-module python-python-python2-withpy3

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


Reply to: