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

[SCM] Debian package checker branch, master, updated. 2.4.3-211-gacbe42b



The following commit has been merged in the master branch:
commit acbe42b672ac2b1edcd80d3d6116d4a4789c50a8
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Jan 30 23:37:53 2011 +0100

    Check for Python eggs, __pycache dirs and ".pyo" Python bytecode
    
      * Summary of tag changes:
        + Added:
          - package-installs-python-bytecode
        + Removed:
          - package-installs-python-pyc (replaced by
            package-installs-python-bytecode)
    
     * check/files{,.desc}:
        + [NT] Added check for packages installing Python eggs and
          __pycache__ directories.  Also extended existing Python bytecode
          check to include ".pyo" files.  Thanks to Piotr Ożarowski,
          Jakub Wilk and the people in #debian-python for the report and
          help with implementing this.  (Closes: #576005)

diff --git a/checks/files b/checks/files
index 39943ea..eedd282 100644
--- a/checks/files
+++ b/checks/files
@@ -716,9 +716,23 @@ foreach my $file (@{$info->sorted_index}) {
 	}
     }
 
-    # ---------------- .pyc (compiled python files
-    if ($file =~ m,^usr/lib/python\d\.\d/.*.pyc$,) {
-	tag 'package-installs-python-pyc', $file
+    # ---------------- .pyc/.pyo (compiled python files)
+    #  skip any file installed inside a __pycache__ directory
+    #  - we have a separate check for that directory.
+    if ($file =~ m,\.py[co]$,o && $file !~ m,/__pycache__/,o) {
+	tag "package-installs-python-bytecode", "$file";
+    }
+
+    # ---------------- __pycache__ (directory for pyc/pyo files)
+    if ($index_info->{type} =~ m/^d/o && $file =~ m,/__pycache__/,o){
+	tag "package-installs-python-pycache-dir", "$file";
+    }
+
+    # ---------------- .egg (python egg files)
+    if ($file =~ m,\.egg$,o && 	($file =~ m,usr/lib/python\d+(?:\.\d+/),o ||
+				 $file =~ m,usr/lib/pyshared,o ||
+				 $file =~ m,usr/share/,o)){
+	tag "package-installs-python-egg", "$file";
     }
 
     # ---------------- /usr/lib/site-python
diff --git a/checks/files.desc b/checks/files.desc
index 6cb0921..9dd1a0c 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -779,12 +779,33 @@ Info: The package installs a file in usr/share/python-support/ but does
  This can happen if ${python:Depends} was omitted from the Depends field
  in debian/control.
 
-Tag: package-installs-python-pyc
+Tag: package-installs-python-bytecode
 Severity: serious
 Certainty: certain
+Ref: python-policy 2.6
 Info: Compiled python source files must not be included in the package.
  These files should be removed from the package and created at package
- installation time in the postinst. 
+ installation time in the postinst.
+
+Tag: package-installs-python-egg
+Severity: serious
+Certainty: possible
+Ref: python-policy 2.6
+Info: Python eggs should not be installed, since the Debian package is
+ supposed to do the required steps for installing the Python code.
+ .
+ The egg may contain pre-compiled python bytecode or shared libraries.
+
+Tag: package-installs-python-pycache-dir
+Severity: serious
+Certainty: certain
+Ref: python-policy 2.6
+Info: The package installs a __pycache__ directory, which is normally
+ only used to store compiled python source files. Compiled python
+ source files must not be included in the package, instead they
+ should be generated at installation time in the postinst.
+ .
+ Note this tag is issues even if the directory is empty.
 
 Tag: bad-permissions-for-ali-file
 Severity: normal
diff --git a/data/output/ftp-master-fatal b/data/output/ftp-master-fatal
index 69d1594..358336f 100644
--- a/data/output/ftp-master-fatal
+++ b/data/output/ftp-master-fatal
@@ -52,7 +52,7 @@ not-allowed-control-file
 old-style-copyright-file
 package-contains-ancient-file
 package-has-no-description
-package-installs-python-pyc
+package-installs-python-bytecode
 package-not-lowercase
 package-uses-local-diversion
 section-is-dh_make-template
diff --git a/debian/changelog b/debian/changelog
index 8cd1b8f..d43973e 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,11 +15,14 @@ lintian (2.5.0) UNRELEASED; urgency=low
       - missing-dependency-on-python-central
       - python-module-in-wrong-location
       - missing-dependency-on-python-support
+      - package-installs-python-bytecode
     + Removed:
       - embedded-zlib (now in embedded-library)
       - embedded-libpng (now in embedded-library)
       - embedded-libjpeg (now in embedded-library)
       - embedded-libopenjpeg (now in embedded-library)
+      - package-installs-python-pyc (replaced by
+        package-installs-python-bytecode)
 
   * checks/*:
     + [NT] Use the new pre-sorted file {index,info} when iterating over files.
@@ -100,6 +103,11 @@ lintian (2.5.0) UNRELEASED; urgency=low
       world readable file permissions.
     + [NT] Added check for missing dependency on python-support.
       Thanks to Jakub Wilk for the report.  (Closes: #592491)
+    + [NT] Added check for packages installing Python eggs and
+      __pycache__ directories.  Also extended existing Python bytecode
+      check to include ".pyo" files.  Thanks to Piotr Ożarowski,
+      Jakub Wilk and the people in #debian-python for the report and
+      help with implementing this.  (Closes: #576005)
   * checks/menu-format.desc:
     + [CW] Fix several typos.
   * checks/menus.desc:
diff --git a/t/COVERAGE b/t/COVERAGE
index 67ddd0a..7325998 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -94,6 +94,7 @@ files package-installs-font-to-usr-x11r6
 files package-installs-into-etc-rc.boot
 files package-installs-into-etc-rc.d
 files package-installs-perllocal-pod
+files package-installs-python-pyc
 files package-uses-obsolete-file
 files perl-module-in-core-directory
 files setgid-binary
@@ -257,7 +258,6 @@ files package-installs-file-to-usr-x11r6-bin
 files package-installs-into-etc-gconf-schemas
 files package-installs-nonbinary-perl-in-usr-lib-perl5
 files package-installs-packlist
-files package-installs-python-pyc
 files script-in-usr-share-doc
 files script-with-language-extension
 files setuid-binary
@@ -545,7 +545,6 @@ scripts
   init.d-script-missing-lsb-short-description
   non-standard-executable-perm
   non-standard-setuid-executable-perm
-  package-installs-python-pyc
   php-script-but-no-phpX-cli-dep
   python-script-but-no-python-dep
   script-in-usr-share-doc
diff --git a/t/tests/files-objects-inv/debian/debian/install b/t/tests/files-objects-inv/debian/debian/install
deleted file mode 100644
index 07f0eb9..0000000
--- a/t/tests/files-objects-inv/debian/debian/install
+++ /dev/null
@@ -1 +0,0 @@
-objects.inv usr/share/doc/python-kinterbasdb/docs/
diff --git a/t/tests/files-objects-inv/desc b/t/tests/files-objects-inv/desc
deleted file mode 100644
index 7ee3493..0000000
--- a/t/tests/files-objects-inv/desc
+++ /dev/null
@@ -1,7 +0,0 @@
-Testname: files-objects-inv
-Sequence: 6000
-Version: 1.0
-Description: Test tags for compressed objects.inv files
-References: Debian Bug#608810
-Test-For:
- compressed-objects.inv
diff --git a/t/tests/files-objects-inv/tags b/t/tests/files-objects-inv/tags
deleted file mode 100644
index ce5d810..0000000
--- a/t/tests/files-objects-inv/tags
+++ /dev/null
@@ -1 +0,0 @@
-W: python-kinterbasdb: compressed-objects.inv usr/share/doc/python-kinterbasdb/docs/objects.inv.gz
diff --git a/t/tests/files-python-general/debian/code.pyc b/t/tests/files-python-general/debian/code.pyc
new file mode 100644
index 0000000..5a11df8
--- /dev/null
+++ b/t/tests/files-python-general/debian/code.pyc
@@ -0,0 +1 @@
+Hallo world
diff --git a/t/tests/files-python-general/debian/code.pyo b/t/tests/files-python-general/debian/code.pyo
new file mode 100644
index 0000000..5a11df8
--- /dev/null
+++ b/t/tests/files-python-general/debian/code.pyo
@@ -0,0 +1 @@
+Hallo world
diff --git a/t/tests/files-objects-inv/debian/debian/control.in b/t/tests/files-python-general/debian/debian/control.in
similarity index 100%
rename from t/tests/files-objects-inv/debian/debian/control.in
rename to t/tests/files-python-general/debian/debian/control.in
diff --git a/t/tests/files-python-general/debian/debian/install b/t/tests/files-python-general/debian/debian/install
new file mode 100644
index 0000000..332e6f1
--- /dev/null
+++ b/t/tests/files-python-general/debian/debian/install
@@ -0,0 +1,6 @@
+code.pyc usr/share/python-kinterbasdb/
+code.pyo usr/share/python-kinterbasdb/
+code.pyc usr/share/python-kinterbasdb/__pycache__/
+code.pyo usr/share/python-kinterbasdb/__pycache__/
+objects.inv usr/share/doc/python-kinterbasdb/docs/
+python.egg usr/share/python-kinterbasdb/
diff --git a/t/tests/files-objects-inv/debian/debian/rules b/t/tests/files-python-general/debian/debian/rules
similarity index 100%
rename from t/tests/files-objects-inv/debian/debian/rules
rename to t/tests/files-python-general/debian/debian/rules
diff --git a/t/tests/files-objects-inv/debian/objects.inv b/t/tests/files-python-general/debian/objects.inv
similarity index 100%
rename from t/tests/files-objects-inv/debian/objects.inv
rename to t/tests/files-python-general/debian/objects.inv
diff --git a/t/tests/changelog-file-missing/upstream/README b/t/tests/files-python-general/debian/python.egg
similarity index 100%
copy from t/tests/changelog-file-missing/upstream/README
copy to t/tests/files-python-general/debian/python.egg
diff --git a/t/tests/files-python-general/desc b/t/tests/files-python-general/desc
new file mode 100644
index 0000000..0ddcaf8
--- /dev/null
+++ b/t/tests/files-python-general/desc
@@ -0,0 +1,10 @@
+Testname: files-python-general
+Sequence: 6000
+Version: 1.0
+Description: Test general python related tags
+References: Debian Bug#608810, Debian Bug#756005
+Test-For:
+ compressed-objects.inv
+ package-installs-python-bytecode
+ package-installs-python-egg
+ package-installs-python-pycache-dir
diff --git a/t/tests/files-python-general/tags b/t/tests/files-python-general/tags
new file mode 100644
index 0000000..6383a44
--- /dev/null
+++ b/t/tests/files-python-general/tags
@@ -0,0 +1,5 @@
+E: python-kinterbasdb: package-installs-python-bytecode usr/share/python-kinterbasdb/code.pyc
+E: python-kinterbasdb: package-installs-python-bytecode usr/share/python-kinterbasdb/code.pyo
+E: python-kinterbasdb: package-installs-python-egg usr/share/python-kinterbasdb/python.egg
+E: python-kinterbasdb: package-installs-python-pycache-dir usr/share/python-kinterbasdb/__pycache__/
+W: python-kinterbasdb: compressed-objects.inv usr/share/doc/python-kinterbasdb/docs/objects.inv.gz
diff --git a/testset/tags.scripts b/testset/tags.scripts
index 7a28fcb..06fb88b 100644
--- a/testset/tags.scripts
+++ b/testset/tags.scripts
@@ -11,7 +11,7 @@ E: scripts: init.d-script-has-duplicate-lsb-section etc/init.d/lsb-broken
 E: scripts: init.d-script-has-unterminated-lsb-section etc/init.d/lsb-broken:15
 E: scripts: missing-dep-for-interpreter jruby => jruby | jruby1.0 | jruby1.1 | jruby1.2 (usr/bin/jruby-broken)
 E: scripts: missing-dep-for-interpreter lefty => graphviz (usr/bin/lefty-foo)
-E: scripts: package-installs-python-pyc usr/lib/python2.3/site-packages/test.pyc
+E: scripts: package-installs-python-bytecode usr/lib/python2.3/site-packages/test.pyc
 E: scripts: php-script-but-no-phpX-cli-dep usr/share/scripts/php5foo
 E: scripts: php-script-but-no-phpX-cli-dep usr/share/scripts/phpfoo
 E: scripts: python-script-but-no-python-dep usr/bin/py2foo

-- 
Debian package checker


Reply to: