[SCM] Debian package checker branch, master, updated. 2.5.0-rc3-14-g846e0c0
The following commit has been merged in the master branch:
commit ef69f7b3722cf32e923c9ce4f8ad68de93f8aa9a
Author: Niels Thykier <niels@thykier.net>
Date: Mon Apr 25 20:36:58 2011 +0200
Added md5sums cache to L::Collect::Binary
diff --git a/checks/md5sums b/checks/md5sums
index 9e6e20a..aebeb19 100644
--- a/checks/md5sums
+++ b/checks/md5sums
@@ -29,6 +29,7 @@ sub run {
my $pkg = shift;
my $type = shift;
+my $info = shift;
my $control = 'control/md5sums';
@@ -36,27 +37,14 @@ my %control_entry;
my %info_entry;
my %conffile;
-# read in md5sums info file
-open(C, '<', 'md5sums') or fail("cannot open md5sums info file: $!");
-while (<C>) {
- chop;
- next if m/^\s*$/;
- m/^(\S+)\s*(\S.*)$/ or fail("syntax error in md5sums info file: $_");
- my $zzsum = $1;
- my $zzfile = $2;
- $zzfile =~ s,^(\./)?,,;
- $info_entry{$zzfile} = $zzsum;
-}
-close(C);
-
# read in conffiles
if (-f 'control/conffiles') {
open(C, '<', 'control/conffiles')
or fail("cannot open control file conffiles: $!");
while (<C>) {
chop;
- next if m/^\s*$/;
- s,^/,,;
+ next if m/^\s*$/o;
+ s,^/,,o;
$conffile{$_} = 1;
}
close(C);
@@ -72,7 +60,9 @@ unless (-f $control) {
# for conffiles since this information would
# be redundant
my $only_conffiles = 1;
- foreach my $file (keys %info_entry) {
+ foreach my $file (@{ $info->sorted_index }) {
+ # skip symlinks
+ next if $info->index->{$file}->{type} eq 'l';
unless ($conffile{$file}) {
$only_conffiles = 0;
last;
@@ -104,17 +94,19 @@ close(C);
for my $file (keys %control_entry) {
- if (not exists $info_entry{$file}) {
+ my $md5sum = $info->md5sums->{$file};
+ if (not defined $md5sum) {
tag 'md5sums-lists-nonexisting-file', $file;
- } elsif ($info_entry{$file} ne $control_entry{$file}) {
+ } elsif ($md5sum ne $control_entry{$file}) {
tag 'md5sum-mismatch', $file;
}
delete $info_entry{$file};
}
-for my $file (keys %info_entry) {
+for my $file (keys %{ $info->md5sums }) {
+ next if $control_entry{$file};
tag 'file-missing-in-md5sums', $file
- unless ($conffile{$file} || $file =~ m%^var/lib/[ai]spell/.%);
+ unless ($conffile{$file} || $file =~ m%^var/lib/[ai]spell/.%o);
}
}
diff --git a/checks/md5sums.desc b/checks/md5sums.desc
index 50f4b24..b4409ab 100644
--- a/checks/md5sums.desc
+++ b/checks/md5sums.desc
@@ -2,7 +2,7 @@ Check-Script: md5sums
Author: Christian Schwarz <schwarz@debian.org>
Abbrev: md5
Type: binary
-Needs-Info: md5sums, bin-pkg-control
+Needs-Info: md5sums, bin-pkg-control, index
Info: This script checks if md5sum control files are valid, if they are
provided by a binary package.
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 985e7b5..39ad527 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -178,6 +178,32 @@ sub sorted_file_info{
return \@result;
}
+# Returns the md5sums as calculated by the md5sums collection
+# sub md5sums Needs-Info md5sums
+sub md5sums {
+ my ($self) = @_;
+ return $self->{md5sums} if exists $self->{md5sums};
+ my $base_dir = $self->base_dir();
+ my $result = {};
+
+ # read in md5sums info file
+ open(my $fd, '<', "$base_dir/md5sums")
+ or fail("cannot open $base_dir/md5sums info file: $!");
+ while (my $line = <$fd>) {
+ chop($line);
+ next if $line =~ m/^\s*$/o;
+ $line =~ m/^(\S+)\s*(\S.*)$/o
+ or fail("syntax error in $base_dir/md5sums info file: $line");
+ my $zzsum = $1;
+ my $zzfile = $2;
+ $zzfile =~ s,^(?:\./)?,,o;
+ $result->{$zzfile} = $zzsum;
+ }
+ close($fd);
+ $self->{md5sums} = $result;
+ return $result;
+}
+
sub scripts {
my ($self) = @_;
return $self->{scripts} if exists $self->{scripts};
--
Debian package checker
Reply to: