Here it is :) Sylvestre
On 03/04/2014 12:19, Bastien ROUCARIES wrote: > I will prefer a patch using Lintian::Data > > Could be override by derivative and backport > > Bastien > > On Wed, Apr 2, 2014 at 12:48 PM, Sylvestre Ledru <sylves...@debian.org> wrote: >> On 02/04/2014 10:33, Emmanuel Bourg wrote: >>> Package: lintian >>> Version: 2.5.22.1 >>> Severity: normal >>> >>> Hi, >>> >>> Could you please support the Java 8 class version in the >>> unknown-java-class-version check? OpenJDK 8 is being packaged and >>> lintian complains about the new class version (52 for Java 8, Java 7 >>> used 51) >>> >> The attached patch should fix it. >> >> Cheers, >> Sylvestre >>
>From fb326f966d4ea9c0fd93ca4ef6d5cfcf8ce167f5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru <sylves...@debian.org> Date: Fri, 11 Apr 2014 18:58:39 +0200 Subject: [PATCH] Catch uses of Java8 byte code --- checks/java.desc | 2 +- checks/java.pm | 12 ++++++++---- data/java/constants | 13 +++++++++++++ debian/changelog | 3 +++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 data/java/constants diff --git a/checks/java.desc b/checks/java.desc index e73b37c..bf55937 100644 --- a/checks/java.desc +++ b/checks/java.desc @@ -108,7 +108,7 @@ Info: The package contains a Jar file with Java class files compiled for an for a newer version of Java than Lintian knows about. In the latter case, please file a bug against Lintian. . - Latest class version known by Lintian is Java7 (Major version 51). + Latest class version known by Lintian is Java8 (Major version 52). Tag: zip-parse-error Severity: normal diff --git a/checks/java.pm b/checks/java.pm index fc30a83..96f40bd 100644 --- a/checks/java.pm +++ b/checks/java.pm @@ -24,10 +24,13 @@ use warnings; use autodie; use List::MoreUtils qw(any none); +use Lintian::Data (); use Lintian::Tags qw(tag); use Lintian::Util qw(normalize_pkg_path); +our $MAX_BYTECODE = Lintian::Data->new('java/constants', qr/\s*=\s*/o); + sub run { my ($pkg, undef, $info) = @_; my $java_info = $info->java_info; @@ -81,11 +84,11 @@ sub run { my $mver = $files->{$class}; $classes = 1; next if $class =~ m/\.clj$/; - # .class but no major version? + # .class but no major evrsion? next if $mver eq '-'; - if ($mver <= 44 or $mver >= 52) { + if ($mver <= $MAX_BYTECODE->value('min-bytecode-version') - 1 or $mver >= $MAX_BYTECODE->value('max-bytecode-existing-version')) { # First public major version was 45 (Java1), latest - # version is 51 (Java7). + # version is 52 (Java8). tag 'unknown-java-class-version', $jar_file, "($class -> $mver)"; # Skip the rest of this Jar. @@ -205,10 +208,11 @@ sub run { # 45-49 -> Java1 - Java5 (Always ok) # 50 -> Java6 # 51 -> Java7 + # 52 -> Java8 my $bad = 0; # If the lowest version used is: - $bad = 1 if $jmajlow == 51; # Java7 - consider bad per request. + $bad = 1 if $jmajlow == $MAX_BYTECODE->value('max-bytecode-version') + 1 ; # Java7 - consider bad per request. # Technically we ought to do some checks with Java6 class files and # dependencies/package types, but for now just skip that. (See #673276) diff --git a/data/java/constants b/data/java/constants new file mode 100644 index 0000000..f618e26 --- /dev/null +++ b/data/java/constants @@ -0,0 +1,13 @@ +# This defines the maximal version of Java bytecode +# to make sure it runs on older JVM +# Byte code numbers: +# 45-49 -> Java1 - Java5 (Always ok) +# 50 -> Java6 - Current max version in Debian +# 51 -> Java7 +# 52 -> Java8 +max-bytecode-version = 50 + +max-bytecode-existing-version = 52 + +# The following should not change +min-bytecode-version = 45 diff --git a/debian/changelog b/debian/changelog index 14bcc0b..1fb1330 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,9 @@ lintian (2.5.22.2) UNRELEASED; urgency=medium + [SL] Do not trigger a warning when a jar is not in /usr/share/java and the package name matches lib.*maven.*plugin.*java. + + [SL] Catch uses of Java8 byte code + * data/java/constants: + + [SL] introduce this file to specify JDK values -- Bastien Roucariès <roucaries.bastien+deb...@gmail.com> Mon, 31 Mar 2014 18:52:04 +0200 -- 1.9.1.662.g3e70902