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

[SCM] Debian package checker branch, master, updated. 2.4.3-139-g37b89fc



The following commit has been merged in the master branch:
commit 37b89fcce62cf849157087cdeac50d5324cee92e
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Jan 19 14:00:03 2011 +0100

    Added check for malplaced Python modules
    
      * Summary of tag changes:
        + Added:
          - python-module-in-wrong-location
    
      * checks/files{,.desc}
        + [NT] Added check for malplaced Python modules. Thanks to
          Jakub Wilk for the report.  (Closes: #576012)

diff --git a/checks/files b/checks/files
index 4d16101..09aaa6b 100644
--- a/checks/files
+++ b/checks/files
@@ -811,6 +811,50 @@ foreach my $file (@{$info->sorted_index}) {
 	tag "missing-dependency-on-python-central" unless ($dep->implies('python-central (>= 0.6)'));
     }
 
+    # ---------------- python file locations
+    #  - The python people kindly provided the following table.
+    # good:
+    # /usr/lib/python2.5/site-packages/
+    # /usr/lib/python2.6/dist-packages/
+    # /usr/lib/python2.7/dist-packages/
+    # /usr/lib/python3/dist-packages/
+    #
+    # bad:
+    # /usr/lib/python2.5/dist-packages/
+    # /usr/lib/python2.6/site-packages/
+    # /usr/lib/python2.7/site-packages/
+    # /usr/lib/python3.*/*-packages/
+    if ($file =~ m,^(usr/lib/debug/)?usr/lib/python(\d+(?:\.\d+)?)/(site|dist)-packages/(.++)$,o){
+	my ($debug, $pyver, $loc, $rest) = ($1, $2, $3, $4);
+	my ($pmaj, $pmin) = split(m/\./o, $pyver, 2);
+	my @correction = ();
+	$pmin = 0 unless (defined $pmin);
+	$debug = '' unless (defined $debug);
+	next if ($pmaj < 2 or $pmaj > 3); # Not python 2 or 3
+	if ($pmaj == 2 and $pmin < 6){
+	    # 2.4 and 2.5
+	    if ($loc ne 'site') {
+		@correction = ("${debug}usr/lib/python${pyver}/$loc-packages/$rest",
+			       "${debug}usr/lib/python${pyver}/site-packages/$rest");
+	    }
+	} elsif ($pmaj == 3){
+	    # python 3. Everything must be in python3/dist-... and not python3.X/<something>
+	    my @files;
+	    if ($pyver ne '3' or $loc ne 'dist'){
+		# bad mojo
+		@correction = ("${debug}usr/lib/python${pyver}/$loc-packages/$rest",
+			       "${debug}usr/lib/python3/dist-packages/$rest");
+	    }
+	} else {
+	    # python 2.6+
+	    if ($loc ne 'dist') {
+		@correction = ("${debug}usr/lib/python${pyver}/$loc-packages/$rest",
+			       "${debug}usr/lib/python${pyver}/dist-packages/$rest");
+	    }
+	}
+	tag "python-module-in-wrong-location", @correction if (@correction);
+    }
+
     # ---------------- plain files
     if ($index_info->{type} =~ m/^[-h]/) {
 	my $wanted_operm;
diff --git a/checks/files.desc b/checks/files.desc
index d0ca45f..cb8ee00 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -741,6 +741,15 @@ Info: The directory /usr/lib/site-python has been deprecated as a
  private module and should be packaged in a directory outside of Python's
  default search path.
 
+Tag: python-module-in-wrong-location
+Severity: normal
+Certainty: possible
+Ref: python-policy1.5,  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=576012
+Info: The package installs a Python module or debug information for a Python
+ module in the wrong location for the given version of Python.
+ .
+ dh_python3 can be used to fix this for Python 3 modules.
+
 Tag: python-debug-in-wrong-location
 Severity: normal
 Certainty: possible
diff --git a/debian/changelog b/debian/changelog
index 96ae674..e944e2e 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ lintian (2.4.4) UNRELEASED; urgency=low
       - python-debug-in-wrong-location
       - debian-watch-contains-dh_make-template
       - missing-dependency-on-python-central
+      - python-module-in-wrong-location
 
   * checks/*:
     + [NT] Use the new pre-sorted file {index,info} when iterating over files.
@@ -72,6 +73,8 @@ lintian (2.4.4) UNRELEASED; urgency=low
       Jakub Wilk for the report.  (Closes: #576014)
     + [NT] Added check for missing dependency on python-central.
       Thanks to Jakub Wilk for the report.  (Closes: #592533)
+    + [NT] Added check for malplaced Python modules. Thanks to
+      Jakub Wilk for the report.  (Closes: #576012)
   * checks/menu-format.desc:
     + [CW] Fix several typos.
   * checks/menus.desc:
diff --git a/t/tests/files-objects-inv/debian/debian/control.in b/t/tests/files-python-modules/debian/debian/control.in
similarity index 93%
copy from t/tests/files-objects-inv/debian/debian/control.in
copy to t/tests/files-python-modules/debian/debian/control.in
index 79a6d1c..1b72861 100644
--- a/t/tests/files-objects-inv/debian/debian/control.in
+++ b/t/tests/files-python-modules/debian/debian/control.in
@@ -5,7 +5,7 @@ Maintainer: {$author}
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7.0.50~)
 
-Package: python-kinterbasdb
+Package: python-foo
 Architecture: all
 Depends: $\{misc:Depends\},
 Description: {$description}
@@ -13,4 +13,3 @@ Description: {$description}
  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.
-
diff --git a/t/tests/files-python-modules/debian/debian/install b/t/tests/files-python-modules/debian/debian/install
new file mode 100644
index 0000000..99b0694
--- /dev/null
+++ b/t/tests/files-python-modules/debian/debian/install
@@ -0,0 +1,13 @@
+# GOOD
+python-foo /usr/lib/python2.5/site-packages/
+python-foo /usr/lib/python2.6/dist-packages/
+python-foo /usr/lib/python2.7/dist-packages/
+python-foo /usr/lib/python3/dist-packages/
+
+# BAD
+python-foo usr/lib/python2.5/dist-packages/
+python-foo usr/lib/python2.6/site-packages/
+python-foo usr/lib/python2.7/site-packages/
+python-foo usr/lib/python3.1/dist-packages/
+python-foo usr/lib/python3.1/site-packages/
+
diff --git a/t/tests/lintian-output-colons/debian/debian/rules b/t/tests/files-python-modules/debian/debian/rules
old mode 100755
new mode 100644
similarity index 54%
copy from t/tests/lintian-output-colons/debian/debian/rules
copy to t/tests/files-python-modules/debian/debian/rules
index 67e7058..d769a32
--- a/t/tests/lintian-output-colons/debian/debian/rules
+++ b/t/tests/files-python-modules/debian/debian/rules
@@ -1,5 +1,7 @@
 #!/usr/bin/make -f
+
 %:
 	dh $@
 
-override_dh_usrlocal:
+override_dh_pysupport:
+
diff --git a/t/tests/files-python-helpers/debian/python-foo b/t/tests/files-python-modules/debian/python-foo
similarity index 100%
copy from t/tests/files-python-helpers/debian/python-foo
copy to t/tests/files-python-modules/debian/python-foo
diff --git a/t/tests/files-python-modules/desc b/t/tests/files-python-modules/desc
new file mode 100644
index 0000000..72ea075
--- /dev/null
+++ b/t/tests/files-python-modules/desc
@@ -0,0 +1,6 @@
+Testname: files-python-modules
+Sequence: 6000
+Version: 1.0
+Description: Test tags for misplaced Python modules
+Test-For:
+ python-module-in-wrong-location
diff --git a/t/tests/files-python-modules/tags b/t/tests/files-python-modules/tags
new file mode 100644
index 0000000..c12c0db
--- /dev/null
+++ b/t/tests/files-python-modules/tags
@@ -0,0 +1,5 @@
+W: python-foo: python-module-in-wrong-location usr/lib/python2.5/dist-packages/python-foo usr/lib/python2.5/site-packages/python-foo
+W: python-foo: python-module-in-wrong-location usr/lib/python2.6/site-packages/python-foo usr/lib/python2.6/dist-packages/python-foo
+W: python-foo: python-module-in-wrong-location usr/lib/python2.7/site-packages/python-foo usr/lib/python2.7/dist-packages/python-foo
+W: python-foo: python-module-in-wrong-location usr/lib/python3.1/dist-packages/python-foo usr/lib/python3/dist-packages/python-foo
+W: python-foo: python-module-in-wrong-location usr/lib/python3.1/site-packages/python-foo usr/lib/python3/dist-packages/python-foo

-- 
Debian package checker


Reply to: