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

[SCM] Debian package checker branch, master, updated. 2.5.3-65-g7eab74a



The following commit has been merged in the master branch:
commit 7eab74a916a61a5fc5d74b6088d469783eed9da4
Author: Jakub Wilk <jwilk@debian.org>
Date:   Thu Oct 13 20:18:04 2011 +0200

    Check for missing python helpers when using python substvars
    
    Acked-By: Niels Thykier <niels@thykier.net>

diff --git a/checks/debhelper b/checks/debhelper
index 31689b0..35bb2e3 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -81,6 +81,9 @@ my $inclcdbs = 0;
 my $seenmaintscript = 0;
 my $bdepends_noarch;
 my $bdepends;
+my $seen_dh = 0;
+my $seen_python_helper = 0;
+my $seen_python3_helper = 0;
 
 open(RULES, '<', "$droot/rules") or fail("cannot read debian/rules: $!");
 
@@ -108,13 +111,21 @@ while (<RULES>) {
         }
         if ($dhcommand eq 'dh_python') {
             tag 'dh_python-is-obsolete', "line $.";
+            $seen_python_helper = 1;
         }
         if ($dhcommand eq 'dh_pycentral') {
             tag 'dh_pycentral-is-obsolete', "line $.";
+            $seen_python_helper = 1;
         }
         if ($dhcommand eq 'dh_installmanpages') {
             tag 'dh_installmanpages-is-obsolete', "line $.";
         }
+        if ($dhcommand eq 'dh_python3') {
+            $seen_python3_helper = 1;
+        }
+        if ($dhcommand =~ m,^dh_(?:pysupport$|python(?:2$|\$.*)),) {
+            $seen_python_helper = 1;
+        }
 
         # Don't warn about recently deprecated commands in code that may be
         # optional.  It may be there only for backports.
@@ -153,6 +164,7 @@ while (<RULES>) {
         $seencommand = 1;
         $needbuilddepends = 1;
     } elsif (m,^\s+dh\s+,) {
+        $seen_dh = 1;
         $seencommand = 1;
         $needbuilddepends = 1;
         $needtomodifyscripts = 1;
@@ -165,8 +177,16 @@ while (<RULES>) {
                 if (defined $depends) {
                     $missingbdeps_addons{$depends} = $addon;
                 }
+                if ($addon =~ m,python(?:2|_central|_support)$,) {
+                    $seen_python_helper = 1;
+                } elsif ($addon eq 'python3') {
+                    $seen_python3_helper = 1;
+                }
             }
         }
+        if ($seen_python_helper == 0) {
+            $seen_python_helper = -1; # maybe; we'll check that later
+        }
     } elsif (m,^include\s+/usr/share/cdbs/1/rules/debhelper.mk,) {
         $seencommand = 1;
         $needbuilddepends = 1;
@@ -406,6 +426,37 @@ if(scalar(@indebfiles)){
     tag 'temporary-debhelper-file', "$f$otext";
 }
 
+if ($seen_python_helper == -1 and $level >= 9) {
+    $seen_python_helper = 0;
+}
+if ($seen_dh and $seen_python_helper != 1) {
+    my %python_depends = ();
+    for my $binpkg (keys %$pkgs) {
+        if ($info->binary_relation($binpkg, 'all')->implies('${python:Depends}')) {
+            $python_depends{$binpkg} = 1;
+        }
+    }
+    if (%python_depends) {
+        if ($seen_python_helper == -1) {
+            $seen_python_helper = $bdepends_noarch->implies('python-support');
+        }
+        if (not $seen_python_helper) {
+            tag 'python-depends-but-no-python-helper', sort(keys %python_depends);
+        }
+    }
+}
+if ($seen_dh and $seen_python3_helper != 1) {
+    my %python3_depends = ();
+    for my $binpkg (keys %$pkgs) {
+        if ($info->binary_relation($binpkg, 'all')->implies('${python3:Depends}')) {
+            $python3_depends{$binpkg} = 1;
+        }
+    }
+    if (%python3_depends and not $seen_python3_helper) {
+        tag 'python3-depends-but-no-python3-helper', sort(keys %python3_depends);
+    }
+}
+
 }
 
 1;
diff --git a/checks/debhelper.desc b/checks/debhelper.desc
index 1c2e63f..061e93d 100644
--- a/checks/debhelper.desc
+++ b/checks/debhelper.desc
@@ -288,3 +288,22 @@ Certainty: possible
 Info: The package build-depends on cdbs, but does not include any cdbs
  files in <tt>debian/rules</tt>.
 
+Tag: python-depends-but-no-python-helper
+Severity: serious
+Certainty: possible
+Experimental: yes
+Info: The source package declares a dependency on ${python:Depends} in the
+ given binary package's debian/control entry.  However, debian/rules doesn't
+ call any helper that would generate this substitution variable.
+ .
+ When using debhelper compatibility level below 9, dh will call dh_pysupport by
+ default if it's installed, but the build dependency on python-support is still
+ necessary.
+
+Tag: python3-depends-but-no-python3-helper
+Severity: serious
+Certainty: possible
+Experimental: yes
+Info: The source package declares a dependency on ${python3:Depends} in the
+ given binary package's debian/control entry.  However, debian/rules doesn't
+ call any helper that would generate this substitution variable.
diff --git a/debian/changelog b/debian/changelog
index 1e6183a..0e59f19 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ lintian (2.5.4) UNRELEASED; urgency=low
   * Summary of tag changes:
     + Added:
       - missing-build-dependency-for-dh-addon
+      - python-depends-but-no-python-helper
+      - python3-depends-but-no-python3-helper
 
   * checks/*:
     + [JW] Replace common_data.pm with Lintian::Check.
@@ -28,6 +30,8 @@ lintian (2.5.4) UNRELEASED; urgency=low
       build-dependency-for-dh_-command to improve readability.  This
       breaks overrides, but according to lintian.d.o there are none
       of these.  (Closes: #644339)
+    + [JW] Added check for missing python helpers when using python
+      substvars in d/control.  (Closes: #582511)
   * checks/fields:
     + [NT] Fixed source-field-does-not-match-pkg-name.
   * checks/files{,.desc}:
diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index df52490..84a22dd 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -186,7 +186,7 @@ sub binary_relation {
     if ($special{$field}) {
         my $merged;
         for my $f (@{ $special{$field} }) {
-            # sub binary_relation Needs-Info :binary_field
+            # sub binary_relation Needs-Info debfiles
             my $value = $self->binary_field($package, $f);
             $merged .= ', ' if (defined($merged) and defined($value));
             $merged .= $value if defined($value);
diff --git a/t/tests/fields-section-general/debian/debian/control.in b/t/tests/debhelper-dh-python-helpers/debian/debian/control.in
similarity index 65%
copy from t/tests/fields-section-general/debian/debian/control.in
copy to t/tests/debhelper-dh-python-helpers/debian/debian/control.in
index 808c553..f4dbf05 100644
--- a/t/tests/fields-section-general/debian/debian/control.in
+++ b/t/tests/debhelper-dh-python-helpers/debian/debian/control.in
@@ -1,30 +1,30 @@
 Source: {$srcpkg}
 Priority: extra
-Section: contrib/{$section}
+Section: {$section}
 Maintainer: {$author}
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
 
-Package: {$srcpkg}
+Package: python-cheshire
+Section: python
 Architecture: all
-Section: contrib/dveel
-Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
-Description: {$description} (typo)
+Depends: $\{misc:Depends\}, $\{python:Depends\}
+Description: Cheshire cheese for Python 2.X
  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 package has a typo in its section fields.
+ For Python 2.X.
 
-Package: {$srcpkg}-main
+Package: python3-cheshire
+Section: python
 Architecture: all
-Section: {$section}
-Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
-Description: {$description} (main)
+Depends: $\{misc:Depends\}, $\{python3:Depends\}
+Description: Cheshire cheese for Python 3.X
  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 package can go to main.
+ For Python 3.X.
diff --git a/t/tests/debhelper-dh-python-helpers/desc b/t/tests/debhelper-dh-python-helpers/desc
new file mode 100644
index 0000000..30b13b6
--- /dev/null
+++ b/t/tests/debhelper-dh-python-helpers/desc
@@ -0,0 +1,8 @@
+Testname: debhelper-dh-python-helpers
+Sequence: 6000
+Version: 1.0
+Description: Check if helpers that substitute python:Depends and
+ python3:Depends are called in debian/rules
+Test-For:
+ python-depends-but-no-python-helper
+ python3-depends-but-no-python3-helper
diff --git a/t/tests/debhelper-dh-python-helpers/tags b/t/tests/debhelper-dh-python-helpers/tags
new file mode 100644
index 0000000..c453949
--- /dev/null
+++ b/t/tests/debhelper-dh-python-helpers/tags
@@ -0,0 +1,2 @@
+X: debhelper-dh-python-helpers source: python-depends-but-no-python-helper python-cheshire
+X: debhelper-dh-python-helpers source: python3-depends-but-no-python3-helper python3-cheshire

-- 
Debian package checker


Reply to: