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

[SCM] Debian package checker branch, master, updated. 2.5.0-31-g3319084



The following commit has been merged in the master branch:
commit 33190843844dc9a1025b654e4f4b8616d16eae9c
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jun 4 14:37:17 2011 +0200

    Refined the classpath-contains-relative-path check and desc
    
    Improved the description of the tag and allowed relative classpaths,
    where:
     A) it points to a file (or a symlink) in the package.
     B) it points to a file in /usr/share/java (but not subdirs thereof)
        and the package has at least one strong dependency of on a
        libX-java package.

diff --git a/checks/java b/checks/java
index 107554f..e19ce32 100644
--- a/checks/java
+++ b/checks/java
@@ -53,6 +53,7 @@ for my $jar_file (sort keys %{$java_info}) {
     my $file_list = $java_info->{$jar_file}->{files};
     my $manifest = $java_info->{$jar_file}->{manifest};
     my $operm = $info->{index}->{$jar_file}->{operm};
+    my $jar_dir;
     my $classes = 1;
     my $datafiles = 1;
     my $cp = '';
@@ -61,6 +62,8 @@ for my $jar_file (sort keys %{$java_info}) {
     # The Java Policy says very little about requires for (jars in) JVMs
     next if $jar_file =~ m#usr/lib/jvm(?:-exports)?/[^/]++/#o;
 
+    $jar_dir = $jar_file;
+    $jar_dir =~ s,[^/]+$,,o;
     $has_jars = 1;
 
     if($jar_file =~ m#^usr/share/java/[^/]+\.jar$#o) {
@@ -106,7 +109,7 @@ for my $jar_file (sort keys %{$java_info}) {
         $has_osgi = 1 if $bsname;
     } else {
         # Only run the tests when a classpath is present
-	my $relative = 0;
+	my @relative = ();
 	my @paths = split(m/\s++/o, $cp);
 	$has_classpath = 1;
 	for my $p (@paths) {
@@ -115,8 +118,18 @@ for my $jar_file (sort keys %{$java_info}) {
                 $p =~ s#^\./++##og;
 		if($p !~ m#^(?:file://)?/#o) {
 		    if($p =~ m#/#o) {
+                        my $target = resolve_pkg_path($jar_dir, $p);
+                        my $tinfo;
+                        # Relative link to usr/share/java ? Works if we
+                        # are depending of a Java library.
+                        next if $target =~ m,^usr/share/java/[^/]+.jar$,o
+                            and @java_lib_depends;
+                        $tinfo = $info->{index}->{$target};
+                        # Points to file or link in this package, which is sometimes
+                        #  easier than re-writing the classpath.
+                        next if defined $tinfo && ($tinfo->{type} =~ m/^[-hl]/o);
 			# Relative path with subdirectories.
-			$relative++;
+			push @relative, $p;
 		    }
 
 		    # @todo add an info tag for relative paths, to educate
@@ -125,8 +138,8 @@ for my $jar_file (sort keys %{$java_info}) {
 	    }
 	}
 
-        tag 'classpath-contains-relative-path', "$jar_file: $cp"
-            if $relative;
+        tag 'classpath-contains-relative-path',
+            "$jar_file: " . join(', ', @relative) if @relative;
     }
 }
 
diff --git a/checks/java.desc b/checks/java.desc
index 92c9c6f..2be62e4 100644
--- a/checks/java.desc
+++ b/checks/java.desc
@@ -9,9 +9,18 @@ Info: This script checks if the packages comply with various aspects of the
 Tag: classpath-contains-relative-path
 Severity: normal
 Certainty: possible
-Info: The classpath listed in some of the files references relative path
- with subdirectories. This is probably the remnants of a build-time
- classpath that are not relevant for a JAR bundled in a Debian package.
+Info: The classpath listed in the jar file refers to a potential
+ missing jar file.  This could be the remnants of a build-time
+ classpath that are not relevant for a JAR bundled in a Debian
+ package.
+ .
+ Alternatively, the classpath may be correct, but the package is
+ lacking a jar file or a symlink to it.
+ .
+ Note, Lintian assumes that all (relative) classpaths pointing to
+ /usr/share/java/ (but not subdirs thereof) are satisfied by
+ dependencies as long as there is at least one strong libX-java
+ dependency.
 
 Tag: jar-not-in-usr-share
 Severity: normal
diff --git a/debian/changelog b/debian/changelog
index 9a499aa..e114400 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,9 +18,16 @@ lintian (2.5.1) UNRELEASED; urgency=low
     + [NT] Fixed two misnamed udeb tags, which lead to an internal
       error if triggered.  Thanks to Guillem Jover for the report.
       (Closes: #628754)
-  * checks/java:
+  * checks/java{,.desc}:
     + [NT] Sort the jar files by name, so they are checked in the same
       order.
+    + [NT] Improved the description of classpath-contains-relative-path.
+      (Closes: #629189)
+    + [NT] Reduced false-positives of classpath-contains-relative-path.
+      Relative classpaths are now okay if they point to jar files in
+      /usr/share/java (but not subdirs thereof) and there is a strong
+      libX-java dependency.  Alternatively if the classpath points to
+      a file or a symlink in the package itself, then it is also okay.
   * checks/rules:
     + [NT] Removed code for handling packages with dh_python.
     + [NT] Fixed the code for determining Build-Depends for python

-- 
Debian package checker


Reply to: