[SCM] Debian package checker branch, master, updated. 2.5.6-40-g35bfafa
The following commit has been merged in the master branch:
commit 35bfafaa0fa3d5b7c1660a96790d9bb1e6a84e7d
Author: Niels Thykier <niels@thykier.net>
Date: Mon Apr 2 15:23:24 2012 +0200
L::Collect: Unify index and file_info indexing
This makes sorted_file_info redundant and it is removed as well.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/binaries b/checks/binaries
index f93a0b9..faa4b8b 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -254,7 +254,7 @@ if ($arch ne 'all' and not exists($ARCH_REGEX{$arch})) {
}
# process all files in package
-foreach my $file (@{$info->sorted_file_info}) {
+foreach my $file (@{$info->sorted_index}) {
my $fileinfo = $info->file_info->{$file};
my $objdump = $info->objdump_info->{$file};
diff --git a/checks/changelog-file b/checks/changelog-file
index e0bbdb9..0c50c5e 100644
--- a/checks/changelog-file
+++ b/checks/changelog-file
@@ -47,7 +47,7 @@ my %file_info;
my %is_a_symlink;
# Modify the file_info by following symbolic links.
-for my $file (@{$info->sorted_file_info}) {
+for my $file (@{$info->sorted_index}) {
next unless $file =~ m/doc/o;
$file_info{$file} = $info->file_info->{$file};
diff --git a/checks/ocaml b/checks/ocaml
index 26d150d..bcf56d7 100644
--- a/checks/ocaml
+++ b/checks/ocaml
@@ -79,7 +79,7 @@ my $dev_prefix;
# does the package provide a META file?
my $has_meta = 0;
-foreach my $file (@{$info->sorted_file_info}) {
+foreach my $file (@{$info->sorted_index}) {
my $fileinfo = $info->file_info->{$file};
# For each .cmxa file, there must be a matching .a file (#528367)
diff --git a/checks/ocaml.desc b/checks/ocaml.desc
index 7d727ca..17fee5a 100644
--- a/checks/ocaml.desc
+++ b/checks/ocaml.desc
@@ -3,7 +3,7 @@ Author: Stephane Glondu <steph@glondu.net>
Abbrev: ocaml
Type: binary
Info: This looks for common mistakes in OCaml binary packages.
-Needs-Info: file-info, ar-info
+Needs-Info: file-info, ar-info, index
Tag: ocaml-dangling-cmxa
Severity: serious
diff --git a/checks/scripts b/checks/scripts
index 1c47250..04edafa 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -254,6 +254,8 @@ my $info = shift;
foreach (@{$info->sorted_index}) {
next if $_ eq '';
+ $ELF{$_} = 1 if $info->file_info->{$_} =~ /^[^,]*\bELF\b/o;
+
my $index_info = $info->index->{$_};
my $operm = $index_info->{operm};
next unless $index_info->{type} =~ m,^[-h], and ($operm & 0111);
@@ -261,10 +263,6 @@ foreach (@{$info->sorted_index}) {
$executable{$_} = 1;
}
-for my $file (@{$info->sorted_file_info}) {
- $ELF{$file} = 1 if $info->file_info->{$file} =~ /^[^,]*\bELF\b/o;
-}
-
my $all_deps = '';
for my $field (qw/suggests recommends depends pre-depends provides/) {
if (defined $info->field($field)) {
diff --git a/checks/shared-libs b/checks/shared-libs
index ebf24f1..f954f66 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -73,7 +73,7 @@ foreach my $file (sort keys %{$objdump}) {
if defined $objdump->{$file}->{SONAME};
}
-foreach my $file (@{$info->sorted_file_info}) {
+foreach my $file (@{$info->sorted_index}) {
next unless length $file;
my $fileinfo = $info->file_info->{$file};
if ($fileinfo =~ m/^[^,]*\bELF\b/ && $fileinfo =~ m/shared object/) {
diff --git a/collection/objdump-info b/collection/objdump-info
index e5603ad..ff2dcf0 100755
--- a/collection/objdump-info
+++ b/collection/objdump-info
@@ -42,8 +42,9 @@ open OUT, '>', "$dir/objdump-info"
chdir ("$dir/unpacked")
or fail ("unable to chdir to unpacked: $!\n");
-foreach my $bin (@{ $info->sorted_file_info }) {
+foreach my $bin (@{ $info->sorted_index }) {
my $finfo = $file_info->{$bin};
+
if ($finfo =~ m/^\bELF\b/) {
print OUT "-- $bin\n";
diff --git a/collection/objdump-info.desc b/collection/objdump-info.desc
index 082ab1f..6c6df58 100644
--- a/collection/objdump-info.desc
+++ b/collection/objdump-info.desc
@@ -4,4 +4,4 @@ Info: This script runs objdump(1) over all binaries and object files of a
binary package.
Type: binary, udeb
Version: 1
-Needs-Info: file-info, unpacked
+Needs-Info: file-info, unpacked, index
diff --git a/debian/changelog b/debian/changelog
index 3a8b9f3..721754a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,7 @@ lintian (2.5.7) UNRELEASED; urgency=low
* checks/*:
+ [NT] Remove some old tags that are no longer useful.
(Closes: #663516)
+ + [NT] Migrate to sorted_index from sorted_file_info.
* checks/binaries:
+ [NT] Move embedded library data to a data file.
* checks/deb-format{,.desc}:
@@ -79,6 +80,11 @@ lintian (2.5.7) UNRELEASED; urgency=low
+ [NT] Lazily evaluate the data file.
* lib/Lintian/Collect/Package.pm:
+ [NT] Remove an extra level of quoting in index.
+ + [NT] Remove root dir from sorted_index.
+ + [NT] Keep trailing slash in dir names for file_info.
+ * lib/Lintian/Collect/Binary.pm:
+ + [NT] Remove sorted_file_info as sorted_index now produces
+ an identical list.
* lib/Lintian/Data.pm:
+ [NT] Lazily load data files.
+ [NT] Allow pre-process sub to alter existing value for a key
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 27173d7..0c50326 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -89,19 +89,6 @@ sub control_index {
return $self->_fetch_index_data('control-index', 'control-index');
}
-# Returns sorted file info (eqv to sort keys %{$info->file_info'}), except it is cached.
-# sub sorted_file_info Needs-Info file-info
-sub sorted_file_info{
- my ($self) = @_;
- my $info;
- my @result;
- return $self->{sorted_file_info} if exists $self->{sorted_file_info};
- $info = $self->file_info();
- @result = sort keys %{$info};
- $self->{sorted_file_info} = \@result;
- return \@result;
-}
-
# Returns the md5sums as calculated by the md5sums collection
# sub md5sums Needs-Info md5sums
sub md5sums {
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index 7d46f41..c543369 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -52,7 +52,6 @@ sub file_info {
my ($file, $info) = ($1,$2);
$file =~ s,^\./,,o;
- $file =~ s,/+$,,o;
$file_info{$file} = $info;
}
@@ -79,6 +78,7 @@ sub sorted_index {
return $self->{sorted_index} if exists $self->{sorted_index};
$index = $self->index();
@result = sort keys %{$index};
+ shift @result if scalar @result && $result[0] eq '';
$self->{sorted_index} = \@result;
return \@result;
}
@@ -317,7 +317,7 @@ Note the file names do not have any leading "./" nor "/".
Returns a sorted list of all files listed in index (or file_info hashref).
-It may contain an "empty" entry denoting the "root dir".
+It does not contain "root dir".
=back
--
Debian package checker
Reply to: