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

[SCM] Debian package checker branch, master, updated. 2.5.5-12-g9cd5238



The following commit has been merged in the master branch:
commit 9cd5238f70bb1a6af7dcdb4e620ed59ae7a2a9f9
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Mar 7 14:53:08 2012 +0100

    coll/strings: Use Lintian::Collect to find ELF files
    
    Also extended t/scripts/needs-info-missing.t to check the Needs-Info
    of collections.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/collection/strings b/collection/strings
index c8153a2..ebb64cc 100755
--- a/collection/strings
+++ b/collection/strings
@@ -24,15 +24,16 @@ use warnings;
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
 use Util;
+use Lintian::Collect;
 use Lintian::Command qw(spawn);
 use Lintian::Command::Simple;
 
 ($#ARGV == 2) or fail('syntax: strings <pkg> <type> <dir>');
 
-my (undef, undef, $dir) = @ARGV;
+my ($pkg, $type, $dir) = @ARGV;
+my $info = Lintian::Collect->new ($pkg, $type, $dir);
 
--f "$dir/file-info"
-    or fail 'strings invoked in wrong directory';
+my $file_info = $info->file_info;
 
 if ( -e "$dir/elf-index" ) {
     unlink "$dir/elf-index" or fail "unlink elf-index: $!";
@@ -45,13 +46,10 @@ if ( -d "$dir/strings" ) {
 open ELF_INDEX, '>', "$dir/elf-index"
     or fail "Could not open 'elf-index' for writing: $!";
 
-open FILE_INFO, '<', "$dir/file-info"
-    or fail "Could not open 'file-info' for reading: $!";
-
-while (<FILE_INFO>) {
-    next unless(m/^(.+?)\x00\s+[^,]*\bELF\b/);
-    my $bin = $1;
 
+foreach my $bin (keys %$file_info) {
+    my $finfo = $file_info->{$bin};
+    next unless $finfo =~ m/\bELF\b/o;
     print ELF_INDEX "$bin\n";
 
     next if ($bin =~ m,^/usr/lib/debug/,);
@@ -66,7 +64,6 @@ while (<FILE_INFO>) {
 }
 
 close(ELF_INDEX) or fail("cannot write elf-index file: $!");
-close(FILE_INFO);
 
 # Local Variables:
 # indent-tabs-mode: nil
diff --git a/debian/changelog b/debian/changelog
index 20d7c60..f5f9960 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,8 @@ lintian (2.5.6) UNRELEASED; urgency=low
   * collection/scripts:
     + [NT] Use "fail" from Util.pm rather than using an embedded
       copy.
+  * collection/strings:
+    + [NT] Use Lintian::Collect to find ELF files.
 
   * frontend/lintian:
     + [NT] Pass directory of the package to the collections.
diff --git a/t/scripts/needs-info-missing.t b/t/scripts/needs-info-missing.t
index 3999fce..87c1add 100755
--- a/t/scripts/needs-info-missing.t
+++ b/t/scripts/needs-info-missing.t
@@ -22,7 +22,8 @@ use Test::More;
 use Util qw(read_dpkg_control slurp_entire_file);
 
 # Find all of the desc files in checks.  We'll do one check per description.
-our @DESCS = (<$ENV{LINTIAN_ROOT}/checks/*.desc>);
+our @DESCS = (<$ENV{LINTIAN_ROOT}/checks/*.desc>,
+              <$ENV{LINTIAN_ROOT}/collection/*.desc>);
 our @MODULES = (<$ENV{LINTIAN_ROOT}/lib/Lintian/Collect.pm>,
 		<$ENV{LINTIAN_ROOT}/lib/Lintian/Collect/*.pm>);
 
@@ -117,7 +118,8 @@ for my $desc (@DESCS) {
     }
 
     my $short = $desc;
-    $short =~ s,^\Q$ENV{LINTIAN_ROOT}/checks/,,;
+    $short =~ s,^\Q$ENV{LINTIAN_ROOT}/,,;
+    $short =~ s,^collection/,coll/,;
     is($missing, 0, "$short has all required needs-info for Lintian::Collect") or
 	diag(@warnings);
 }

-- 
Debian package checker


Reply to: