[SCM] Debian package checker branch, master, updated. 2.5.9-9-g81a9c7c
The following commit has been merged in the master branch:
commit 81a9c7cea9461264dce4dbe0e52088c5d91545ce
Author: Niels Thykier <niels@thykier.net>
Date: Tue Jun 19 16:18:16 2012 +0200
coll/java-info: Use Archive::Zip instead of zipinfo/unzip
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/collection/java-info b/collection/java-info
index ecaca09..3f64b6d 100755
--- a/collection/java-info
+++ b/collection/java-info
@@ -21,6 +21,7 @@
use strict;
use warnings;
+use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use lib "$ENV{'LINTIAN_ROOT'}/lib/";
use Lintian::Collect;
@@ -50,31 +51,40 @@ chdir ("$dir/unpacked")
or fail "unable to chdir to unpacked: $!";
foreach my $file ($info->sorted_index) {
- my $ftype = $info->index->{$file}->{type};
- next unless $ftype eq '-' or $ftype eq 'h';
+ my $ftype = $info->index->{$file};
+ next unless $ftype->is_file;
+ next unless $info->file_info->{$file} =~ m/Zip archive/o;
if ($file =~ m#\S+\.jar$#i) {
my $has_manifest = 0;
+ my $manifest;
+ my $azip = Archive::Zip->new;
open_java_info() unless %opts;
# This script needs unzip, there's no way around.
print {$opts{pipe_in}} "-- $file\n";
+ # stringify or $azip will make a call back that fails.
+ $azip->read ("$file") == AZ_OK or fail "Could not read $file: $!";
+
# First, the file list:
- open FILE_LIST, '-|', 'zipinfo', '-1', $file;
- while(<FILE_LIST>) {
- $has_manifest = 1 if $_ =~ m@^META-INF/MANIFEST.MF$@oi;
- next if( m#/$#o); # Skip directories
- print {$opts{pipe_in}} $_;
+ foreach my $member ($azip->members) {
+ my $name = $member->fileName;
+ next if $member->isDirectory;
+ $manifest = $member if $name =~ m@^META-INF/MANIFEST.MF$@oi;
+ if ($name =~ m/\.class$/o) {
+ # Collect the Major version of the class file.
+ }
+ print {$opts{pipe_in}} $name, "\n";
}
- close FILE_LIST;
- if($has_manifest) {
+ if ($manifest) {
print {$opts{pipe_in}} "-- MANIFEST: $file\n";
- open MANIFEST, '-|', 'unzip', '-p', $file, 'META-INF/MANIFEST.MF';
+ my ($contents, $zerr) = $manifest->contents;
+ fail "Failed to decompress Manifest of $file: $zerr"
+ unless $zerr == AZ_OK;
my $first = 1;
- while(my $line = <MANIFEST>) {
- chomp $line;
+ foreach my $line (split m/\n/, $contents) {
$line =~ s/\r//go;
if($line =~ m/^(\S+:)\s*(.*)/o) {
print {$opts{pipe_in}} "\n" unless $first;
@@ -85,9 +95,7 @@ foreach my $file ($info->sorted_index) {
print {$opts{pipe_in}} substr $line, 1;
}
}
- close MANIFEST;
print {$opts{pipe_in}} "\n" unless $first;
-
}
}
}
diff --git a/collection/java-info.desc b/collection/java-info.desc
index f94669a..1fd441d 100644
--- a/collection/java-info.desc
+++ b/collection/java-info.desc
@@ -3,4 +3,4 @@ Author: Vincent Fourmond <fourmond@debian.org>
Info: This script extracts information from manifests of JAR files
Type: binary
Version: 2
-Needs-Info: unpacked, index
+Needs-Info: index, file-info, unpacked
diff --git a/debian/changelog b/debian/changelog
index 81c85c1..c7246d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,16 @@
lintian (2.5.10) UNRELEASED; urgency=low
+ * collection/java-info{,.desc}:
+ + [NT] Use Archive::Zip instead of zipinfo + unzip to
+ extract information from Jar files.
+ + [NT] Limit java-info to files classified as "Zip Archive"
+ by file(1).
+
+ * debian/control:
+ + [NT] Add (Build-)Dependency on libarchive-zip-perl.
+ + [NT] Remove runtime dependency on unzip (replaced by
+ libarchive-zip-perl).
+
* frontend/lintian:
+ [NT] Check if some collections can be skipped for existing
entries. This is mostly useful for static labs, where
diff --git a/debian/control b/debian/control
index 2a3a733..6352508 100644
--- a/debian/control
+++ b/debian/control
@@ -24,6 +24,7 @@ Build-Depends: binutils,
intltool-debian,
javahelper (>= 0.32~),
libapt-pkg-perl,
+ libarchive-zip-perl,
libc-bin (>= 2.13) | locales,
libclass-accessor-perl,
libclone-perl,
@@ -67,6 +68,7 @@ Depends: binutils,
hardening-includes (>= 2.0),
intltool-debian,
libapt-pkg-perl,
+ libarchive-zip-perl,
libc-bin (>= 2.13) | locales,
libclass-accessor-perl,
libclone-perl,
@@ -80,7 +82,6 @@ Depends: binutils,
man-db,
patchutils,
perl,
- unzip,
${misc:Depends}
Suggests: binutils-multiarch,
dpkg-dev,
--
Debian package checker
Reply to: