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

[lintian] 02/02: Check for packages shipping compiled Java class files. Thanks to Carnë Draug <carandraug+dev@gmail.com>. (Closes: #873211)



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

lamby pushed a commit to branch master
in repository lintian.

commit 0bd1aae6c63e5905c3027d4a2306446ac92d24b6
Author: Chris Lamb <lamby@debian.org>
Date:   Sun Aug 27 08:43:22 2017 +0100

    Check for packages shipping compiled Java class files. Thanks to Carnë Draug <carandraug+dev@gmail.com>. (Closes: #873211)
---
 checks/files.desc                                         |  7 +++++++
 checks/files.pm                                           |  5 +++++
 debian/changelog                                          |  4 +++-
 t/tests/files-java-classfiles/debian/debian/control.in    | 15 +++++++++++++++
 .../debian/debian/libfoo-java.install                     |  1 +
 t/tests/files-java-classfiles/desc                        |  5 +++++
 t/tests/files-java-classfiles/tags                        |  2 ++
 7 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/checks/files.desc b/checks/files.desc
index 17888e1..6e8f18f 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1765,3 +1765,10 @@ Info: This package includes Lintian overrides intended for another package.
  Lintian overrides should be put in a regular file named
  /usr/share/lintian/overrides/<tt>package</tt>
 Ref: lintian 2.4
+
+Tag: package-installs-java-bytecode
+Severity: serious
+Certainty: certain
+Ref: java-policy 2
+Info: Compiled Java source files must not be included in the package. These
+ files should be removed from the package or included in <tt>.jar</tt> archives.
diff --git a/checks/files.pm b/checks/files.pm
index 0dfc84f..aec0465 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -1163,6 +1163,11 @@ sub run {
             tag 'package-contains-python-coverage-file', $file;
         }
 
+        # ---------------- .coverage (coverage.py output)
+        if ($fname =~ m,\.class$,o) {
+            tag 'package-installs-java-bytecode', $file;
+        }
+
         # ---------------- /usr/lib/site-python
         if ($fname =~ m,^usr/lib/site-python/\S,) {
             tag 'file-in-usr-lib-site-python', $file;
diff --git a/debian/changelog b/debian/changelog
index 5142872..09f890d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -44,9 +44,11 @@ lintian (2.5.53) UNRELEASED; urgency=medium
       just python2-foo.  (Closes: #870272)
     + [RG] Do no longer require debug packages to be priority extra.
     + [BR] Use Lintian::Data for name/section mapping
-  * checks/files.pm:
+  * checks/files.{pm,desc}:
     + [BR] Avoid privacy-breach-generic false positives for legal.xml.
     + [BR] Detect install of node package under /usr/lib/nodejs/[^/]*$
+    + [CL] Check for packages shipping compiled Java class files. Thanks
+      Carnë Draug <carandraug+dev@gmail.com>.  (Closes: #873211)
   * checks/init.d.desc:
     + [RG] Do not recommend a versioned dependency on lsb-base in
       init.d-script-needs-depends-on-lsb-base.  (Closes: #847144)
diff --git a/t/tests/files-java-classfiles/debian/debian/control.in b/t/tests/files-java-classfiles/debian/debian/control.in
new file mode 100644
index 0000000..e02d56c
--- /dev/null
+++ b/t/tests/files-java-classfiles/debian/debian/control.in
@@ -0,0 +1,15 @@
+Source: {$source}
+Priority: extra
+Section: java
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+
+Package: libfoo-java
+Architecture: all
+Depends: $\{misc:Depends\}
+Description: {$description}
+ 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.
diff --git a/t/tests/files-java-classfiles/debian/debian/libfoo-java.install b/t/tests/files-java-classfiles/debian/debian/libfoo-java.install
new file mode 100644
index 0000000..52df2a2
--- /dev/null
+++ b/t/tests/files-java-classfiles/debian/debian/libfoo-java.install
@@ -0,0 +1 @@
+mini.class usr/share/java/foo/
diff --git a/t/tests/files-java-classfiles/desc b/t/tests/files-java-classfiles/desc
new file mode 100644
index 0000000..f2e662b
--- /dev/null
+++ b/t/tests/files-java-classfiles/desc
@@ -0,0 +1,5 @@
+Testname: files-java-classfiles
+Version: 1.0
+Description: Test Java classfile related tags
+Test-For:
+ package-installs-java-bytecode
diff --git a/t/tests/files-java-classfiles/tags b/t/tests/files-java-classfiles/tags
new file mode 100644
index 0000000..b4eee08
--- /dev/null
+++ b/t/tests/files-java-classfiles/tags
@@ -0,0 +1,2 @@
+E: libfoo-java: package-installs-java-bytecode usr/share/java/foo/mini.class
+I: libfoo-java: javalib-but-no-public-jars

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


Reply to: