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

Bug#791552: lintian: [new check] verify that JAR filename complies with Debian Java Policy



Package: lintian
Version: 2.5.31
Severity: wishlist

Dear Maintainer,

Please consider adding the attached check for JAR names that are
compliant with the Debian Java Policy.  This warning is useful because
some components of the Debian Java toolchain fail when JAR files don't
comply with the naming policy.

Thank you,
tony
diff --git a/checks/java.desc b/checks/java.desc
index c6aecac..a73897b 100644
--- a/checks/java.desc
+++ b/checks/java.desc
@@ -115,3 +115,10 @@ Severity: normal
 Certainty: certain
 Info: The package contains a Jar file, but Lintian is unable to parse it.
  It is possible that the Jar file is corrupt.
+
+Tag: bad-jar-name
+Severity: normal
+Certainty: certain
+Info: The package contains a Jar file, but the name does not correspond to 
+ Java policy.  This can cause tools in the Debian Java toolchain to fail.
+Ref: java-policy 2.4
diff --git a/checks/java.pm b/checks/java.pm
index f4b7348..5a40868 100644
--- a/checks/java.pm
+++ b/checks/java.pm
@@ -28,6 +28,7 @@ use Lintian::Data ();
 
 use Lintian::Tags qw(tag);
 use Lintian::Util qw(normalize_pkg_path);
+use Lintian::Util qw($PKGNAME_REGEX);
 
 our $MAX_BYTECODE = Lintian::Data->new('java/constants', qr/\s*=\s*/o);
 
@@ -79,6 +80,9 @@ sub run {
         if($jar_file =~ m#^usr/share/java/[^/]+\.jar$#o) {
             $has_public_jars = 1;
         }
+
+        tag 'bad-jar-name' unless (split '/', $jar_file)[-1] =~ /^$PKGNAME_REGEX$/;
+
         # check for common code files like .class or .clj (Clojure files)
         foreach my $class (grep { m/\.(?:class|clj)$/oi } sort keys %{$files}){
             my $mver = $files->{$class};

Reply to: