1 # md5sums -- lintian check script -*- perl -*-
3 # Copyright (C) 1998 Christian Schwarz and Richard Braakman
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, you can find it on the World Wide
17 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
18 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21 package Maemian::md5sums;
31 my $control = "control/md5sums";
37 # read in md5sums info file
38 open(C, '<', "md5sums") or fail("cannot open md5sums info file: $!");
42 m/^(\S+)\s*(\S.*)$/ or fail("syntax error in md5sums info file: $_");
45 $zzfile =~ s,^(\./)?,,;
46 $info_entry{$zzfile} = $zzsum;
51 if (-f "control/conffiles") {
52 open(C, '<', "control/conffiles")
53 or fail("cannot open control file conffiles: $!");
63 # Is there a md5sums control file?
64 unless (-f $control) {
65 # ignore if package contains no files
66 return 0 if -z "md5sums";
68 # check if package contains non-conffiles
69 # debhelper doesn't create entries in md5sums
70 # for conffiles since this information would
72 my $only_conffiles = 1;
73 foreach my $file (keys %info_entry) {
74 unless ($conffile{$file}) {
80 tag "no-md5sums-control-file", "" unless $only_conffiles;
84 # Is it empty? Then skip it. Tag will be issued by control-files
89 # read in md5sums control file
90 open(C, '<', $control)
91 or fail("cannot open md5sums control file $control: $!");
95 if (m{^([a-f0-9]+)\s*(?:\./)?(\S.*)$} && length($1) == 32) {
96 $control_entry{$2} = $1;
98 tag "malformed-md5sums-control-file", "line $.";
103 for my $file (keys %control_entry) {
105 if (not exists $info_entry{$file}) {
106 tag "md5sums-lists-nonexisting-file", "$file";
107 } elsif ($info_entry{$file} ne $control_entry{$file}) {
108 tag "md5sum-mismatch", "$file";
111 delete $info_entry{$file};
113 for my $file (keys %info_entry) {
114 tag "file-missing-in-md5sums", "$file"
115 unless ($conffile{$file} || $file =~ m%^var/lib/[ai]spell/.%);