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

[lintian] 01/02: checks/python.{pm, desc}: Split out Python checks from "scripts" check to a new, source, check of type "source".



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

lamby pushed a commit to branch master
in repository lintian.

commit 4e6bff361a86603ffe0eeb820f94edca44e88861
Author: Chris Lamb <lamby@debian.org>
Date:   Thu Aug 3 20:45:44 2017 -0400

    checks/python.{pm,desc}: Split out Python checks from "scripts" check to a new, source, check of type "source".
---
 checks/python.desc                                 | 19 ++++++++
 checks/python.pm                                   | 51 ++++++++++++++++++++++
 checks/scripts.desc                                | 14 ------
 checks/scripts.pm                                  |  7 ---
 debian/changelog                                   |  3 ++
 profiles/debian/main.profile                       |  2 +-
 .../debian/debian/changelog.in                     |  0
 .../debian/debian/control.in                       |  0
 t/tests/{scripts-python2 => python-python2}/desc   |  2 +-
 t/tests/python-python2/tags                        |  1 +
 t/tests/scripts-python2/tags                       |  1 -
 11 files changed, 76 insertions(+), 24 deletions(-)

diff --git a/checks/python.desc b/checks/python.desc
new file mode 100644
index 0000000..c5030fa
--- /dev/null
+++ b/checks/python.desc
@@ -0,0 +1,19 @@
+Check-Script: python
+Author: Chris Lamb <lamby@debian.org>
+Type: source
+Info: This script checks Python-related issues
+Needs-Info: unpacked, changelog-file
+
+Tag: new-package-should-not-package-python2-module
+Severity: normal
+Certainty: certain
+Info: This package appears to be the initial packaging of a new upstream
+ software package but it appears to package a module for Python 2.
+ .
+ The 2.x series of Python is due for deprecation and will not be maintained
+ past 2020 so it is recommended that Python 2 modules are not packaged unless
+ necessary such as directly requested by an end-user or required as part of a
+ dependency chain.
+ .
+ This warning can be ignored if the package is not intended for Debian or
+ if it is a split of an existing Debian package.
diff --git a/checks/python.pm b/checks/python.pm
new file mode 100644
index 0000000..15d7acd
--- /dev/null
+++ b/checks/python.pm
@@ -0,0 +1,51 @@
+# python -- lintian check script -*- perl -*-
+#
+# Copyright (C) 2016 Chris Lamb
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::python;
+use strict;
+use warnings;
+use autodie;
+
+use Lintian::Tags qw(tag);
+
+sub run {
+    my ($pkg, undef, $info) = @_;
+
+    my @entries = $info->changelog ? $info->changelog->data : ();
+    my @package_names = $info->binaries;
+
+    foreach my $bin (@package_names) {
+        # Python 2 packages
+        if ($bin =~ /^python-.*(?<!-doc)$/) {
+            tag 'new-package-should-not-package-python2-module', $bin
+              if @entries == 1;
+        }
+    }
+
+    return;
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/checks/scripts.desc b/checks/scripts.desc
index 78e31af..f5fe1b2 100644
--- a/checks/scripts.desc
+++ b/checks/scripts.desc
@@ -732,20 +732,6 @@ Certainty: possible
 Info: The maintainer scripts of the package contians one or more
  auto-generated shell snippets inserted by the listed debhelper tool.
 
-Tag: new-package-should-not-package-python2-module
-Severity: normal
-Certainty: certain
-Info: This package appears to be the initial packaging of a new upstream
- software package but it appears to package a module for Python 2.
- .
- The 2.x series of Python is due for deprecation and will not be maintained
- past 2020 so it is recommended that Python 2 modules are not packaged unless
- necessary such as directly requested by an end-user or required as part of a
- dependency chain.
- .
- 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: unconditional-use-of-dpkg-statoverride
 Severity: normal
 Certainty: possible
diff --git a/checks/scripts.pm b/checks/scripts.pm
index 9540dc5..1b098d0 100644
--- a/checks/scripts.pm
+++ b/checks/scripts.pm
@@ -1129,13 +1129,6 @@ sub run {
         }
     }
 
-    my @entries = $info->changelog ? $info->changelog->data : ();
-
-    if (@entries == 1) {
-        tag 'new-package-should-not-package-python2-module', $pkg
-          if $pkg =~ /^python-.*(?<!-doc)$/;
-    }
-
     return;
 }
 
diff --git a/debian/changelog b/debian/changelog
index 9093d1e..3cc48f9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,9 @@ lintian (2.5.53) UNRELEASED; urgency=medium
   * checks/fields.pm:
     + [CL] Ensure that python3-foo packages have "Section: python", not
       just python2-foo.  (Closes: #870272)
+  * checks/python.{pm,desc}:
+    + [CL] Split out Python checks from "scripts" check to a new, source
+      check of type "source".
   * checks/scripts.pm:
     + [CL] Correct false positives in
       unconditional-use-of-dpkg-statoverride by detecting "if !" as a
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
index 7e4d126..712b5cd 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -7,7 +7,7 @@ Enable-Tags-From-Check: apache2, application-not-library, appstream-metadata, au
  debian-source-dir, description, duplicate-files, elpa, fields, filename-length,
  files, gir, group-checks, huge-usr-share, infofiles, init.d, java, lintian,
  manpages, md5sums, menu-format, menus, nmu, obsolete-sites, ocaml,
- patch-systems, phppear, po-debconf, rules, scripts, shared-libs,
+ patch-systems, phppear, po-debconf, python, rules, scripts, shared-libs,
  source-copyright, standards-version, symlinks, systemd, testsuite, triggers,
  udev, upstream-metadata, usrmerge, version-substvars, watch-file
 
diff --git a/t/tests/scripts-python2/debian/debian/changelog.in b/t/tests/python-python2/debian/debian/changelog.in
similarity index 100%
rename from t/tests/scripts-python2/debian/debian/changelog.in
rename to t/tests/python-python2/debian/debian/changelog.in
diff --git a/t/tests/scripts-python2/debian/debian/control.in b/t/tests/python-python2/debian/debian/control.in
similarity index 100%
rename from t/tests/scripts-python2/debian/debian/control.in
rename to t/tests/python-python2/debian/debian/control.in
diff --git a/t/tests/scripts-python2/desc b/t/tests/python-python2/desc
similarity index 86%
rename from t/tests/scripts-python2/desc
rename to t/tests/python-python2/desc
index 56dba16..4f797e7 100644
--- a/t/tests/scripts-python2/desc
+++ b/t/tests/python-python2/desc
@@ -1,4 +1,4 @@
-Testname: scripts-python2
+Testname: python-python2
 Sequence: 6000
 Version: 1.0
 Description: Check various Python 2 issues
diff --git a/t/tests/python-python2/tags b/t/tests/python-python2/tags
new file mode 100644
index 0000000..dea44ce
--- /dev/null
+++ b/t/tests/python-python2/tags
@@ -0,0 +1 @@
+W: python-python2 source: new-package-should-not-package-python2-module python-python-python2
diff --git a/t/tests/scripts-python2/tags b/t/tests/scripts-python2/tags
deleted file mode 100644
index 8542e26..0000000
--- a/t/tests/scripts-python2/tags
+++ /dev/null
@@ -1 +0,0 @@
-W: python-scripts-python2: new-package-should-not-package-python2-module python-scripts-python2

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


Reply to: