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

[lintian] 04/04: Warn about Django libraries that do not depend on Django itself. (Closes: #877292)



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

lamby pushed a commit to branch master
in repository lintian.

commit 6e43f0a8a419b53a81ae5e01f55a0ef4cc180a66
Author: Chris Lamb <lamby@debian.org>
Date:   Sat Sep 30 09:53:30 2017 +0100

    Warn about Django libraries that do not depend on Django itself. (Closes: #877292)
---
 checks/python.desc                                 |  9 ++++
 checks/python.pm                                   |  7 ++++
 debian/changelog                                   |  2 +
 .../debian/debian/control.in                       | 49 ++++++++++++++++++++++
 .../desc                                           |  6 +++
 .../tags                                           |  2 +
 6 files changed, 75 insertions(+)

diff --git a/checks/python.desc b/checks/python.desc
index f17d1bf..e007a9a 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -60,3 +60,12 @@ 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.
+
+Tag: django-package-does-not-depend-on-django
+Severity: normal
+Certainty: certain
+Info: This package appears to be library module for the Django web development
+ framework but it does not specify a binary dependency on the Django package
+ itself.
+ .
+ Please add a Depends on <tt>python-django</tt> or <tt>python3-django</tt>.
diff --git a/checks/python.pm b/checks/python.pm
index 9db2a0e..33890c6 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -88,6 +88,13 @@ sub _run_binary {
         }
     }
 
+    # Django modules
+    if ($pkg =~ /^(python[23]?-django)-.*(?<!-doc)$/) {
+        my $version = $1;
+        tag 'django-package-does-not-depend-on-django', $version
+          if not $info->relation('strong')->implies($version);
+    }
+
     return;
 }
 
diff --git a/debian/changelog b/debian/changelog
index 014ae15..b857d53 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ lintian (2.5.55) UNRELEASED; urgency=medium
   * checks/python.pm:
     + [CL] Move to "Type: source, binary" check type.
     + [CL] Also match packages named "python2-*" as relating to Python 2.x.
+    + [CL] Warn about Django libraries that do not depend on Django itself.
+      (Closes: #877292)
 
   * t/tests/python-new-python2-package/*:
     + [CL] Correct Depends of python2.7 → python3 in Python 3 test
diff --git a/t/tests/python-django-package-does-not-depend-on-django/debian/debian/control.in b/t/tests/python-django-package-does-not-depend-on-django/debian/debian/control.in
new file mode 100644
index 0000000..3b3b58e
--- /dev/null
+++ b/t/tests/python-django-package-does-not-depend-on-django/debian/debian/control.in
@@ -0,0 +1,49 @@
+Source: {$source}
+Priority: optional
+Section: python
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 9)
+
+Package: python-django-positive
+Architecture: all
+Depends: $\{misc:Depends\}, python2.7
+Description: Python 2 package without corresponding python-django dependency
+ 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: python3-django-positive
+Architecture: all
+Depends: $\{misc:Depends\}, python3
+Description: Python 3 package without corresponding python3-django dependency
+ 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.
+
+Package: python-django-false-positive
+Architecture: all
+Depends: $\{misc:Depends\}, python2.7, python-django
+Description: Python 2 package with corresponding python3-django dependency
+ 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 false positive.
+
+Package: python3-django-false-positive
+Architecture: all
+Pre-Depends: python3-django
+Depends: $\{misc:Depends\}, python3
+Description: Python 3 package with corresponding python3-django dependency
+ 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 of the false positive.
diff --git a/t/tests/python-django-package-does-not-depend-on-django/desc b/t/tests/python-django-package-does-not-depend-on-django/desc
new file mode 100644
index 0000000..800a2f1
--- /dev/null
+++ b/t/tests/python-django-package-does-not-depend-on-django/desc
@@ -0,0 +1,6 @@
+Testname: python-django-package-does-not-depend-on-django
+Sequence: 6000
+Version: 1.0
+Description: Check for Django packages that do not specify a Django Depends
+Test-For:
+ django-package-does-not-depend-on-django
diff --git a/t/tests/python-django-package-does-not-depend-on-django/tags b/t/tests/python-django-package-does-not-depend-on-django/tags
new file mode 100644
index 0000000..1871794
--- /dev/null
+++ b/t/tests/python-django-package-does-not-depend-on-django/tags
@@ -0,0 +1,2 @@
+W: python-django-positive: django-package-does-not-depend-on-django python-django
+W: python3-django-positive: django-package-does-not-depend-on-django python3-django

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


Reply to: