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

[SCM] Debian package checker branch, master, updated. 2.4.3-38-g8cd0b42



The following commit has been merged in the master branch:
commit 8cd0b425e0cfa24cf865d545c4e5d9b3593ef0f2
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Dec 24 11:59:30 2010 +0100

    Pre-sort file_info.

diff --git a/checks/binaries b/checks/binaries
index 4d804c7..823cb5c 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -181,7 +181,7 @@ tag "package-name-doesnt-match-sonames", "@sonames"
     if @sonames && !$match_found;
 
 my %directories;
-foreach (sort keys %{$info->file_info}) {
+foreach (@{$info->sorted_file_info}) {
     next unless length $_;
     my $data = $info->file_info->{$_};
     next unless $data eq 'directory' or $data =~ / link to /;
@@ -195,7 +195,7 @@ if ($arch ne 'all' and not exists($ARCH_REGEX{$arch})) {
 }
 
 # process all files in package
-foreach my $file (sort keys %{$info->file_info}) {
+foreach my $file (@{$info->sorted_file_info}) {
     my $fileinfo = $info->file_info->{$file};
     my $objdump = $info->objdump_info->{$file};
 
diff --git a/checks/changelog-file b/checks/changelog-file
index 40f4b0f..42f5a53 100644
--- a/checks/changelog-file
+++ b/checks/changelog-file
@@ -46,7 +46,7 @@ my %file_info;
 my %is_a_symlink;
 
 # Modify the file_info by following symbolic links.
-for my $file (sort keys %{$info->file_info}) {
+for my $file (@{$info->sorted_file_info}) {
     next unless $file =~ m/doc/o;
 
     $file_info{$file} = $info->file_info->{$file};
diff --git a/checks/menus b/checks/menus
index 2c95a0f..5310a01 100644
--- a/checks/menus
+++ b/checks/menus
@@ -89,7 +89,7 @@ if (-f 'control/postrm') {
 }
 
 # read package contents
-for my $file (sort keys %{$info->index}) {
+for my $file (@{$info->sorted_index}) {
     next if $file eq "";
 
     add_file_link_info ($info, $file, \%all_files, \%all_links);
diff --git a/checks/ocaml b/checks/ocaml
index 59af636..ac7d2ff 100644
--- a/checks/ocaml
+++ b/checks/ocaml
@@ -78,7 +78,7 @@ my $dev_prefix;
 # does the package provide a META file?
 my $has_meta = 0;
 
-foreach my $file (sort keys %{$info->file_info}) {
+foreach my $file (@{$info->sorted_file_info}) {
     my $fileinfo = $info->file_info->{$file};
 
     # For each .cmxa file, there must be a matching .a file (#528367)
diff --git a/checks/scripts b/checks/scripts
index 1acd2b0..0a1280c 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -323,7 +323,7 @@ foreach (@{$info->sorted_index}) {
     $suid{'./' . $_} = $is_suid;
 }
 
-for my $file (sort keys %{$info->file_info}) {
+for my $file (@{$info->sorted_file_info}) {
     $ELF{'./' . $file} = 1 if $info->file_info->{$file} =~ /^[^,]*\bELF\b/o;
 }
 
diff --git a/checks/shared-libs b/checks/shared-libs
index b266ba5..6fb812d 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 (sort keys %{$info->file_info}) {
+foreach my $file (@{$info->sorted_file_info}) {
     next unless length $file;
     my $fileinfo = $info->file_info->{$file};
     if ($fileinfo =~ m/^[^,]*\bELF\b/ && $fileinfo =~ m/shared object/) {
diff --git a/debian/changelog b/debian/changelog
index 54c2559..eb611e2 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,7 +8,7 @@ lintian (2.4.4) UNRELEASED; urgency=low
       - description-synopsis-starts-with-article
 
   * checks/*:
-    + [NT] Use the new pre-sorted file index when iterating over files.
+    + [NT] Use the new pre-sorted file {index,info} when iterating over files.
   * checks/binaries:
     + [RA] Exclude kfreebsd-kernel-di-{amd64,i386} from the
       embedded-zlib check since it's in the kernel.  (Closes: #593397)
@@ -74,8 +74,8 @@ lintian (2.4.4) UNRELEASED; urgency=low
     + [NT] Bump debhelper comat to 7.
 
   * lib/Lintian/Collect/Binary.pm:
-    + [NT] Create a sorted file index to avoid sorting it in the checks.
-      (Closes: #605844)
+    + [NT] Create a sorted file index and file info to avoid sorting it
+      in the checks.  (Closes: #605844)
 
   * t/tests/{rules-not-makefile,scripts-missing-dep}:
     + [NT] Added new tests. (Closes: #607731)
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 8198606..50f3d76 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -162,6 +162,21 @@ sub file_info {
     return $self->{file_info};
 }
 
+
+# Returns sorted file info (eqv to sort keys %{$info->file_info}),
+# except it is cached.
+#  sub sorted_file_info Needs-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;
+}
+
 sub scripts {
     my ($self) = @_;
     return $self->{scripts} if exists $self->{scripts};

-- 
Debian package checker


Reply to: