From 2837931024ccbfe17ded29c7c0a3e8fb53e9f988 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Thu, 24 Apr 2003 21:26:59 +0000 Subject: fixed keep of bad package in cache! --- urpm.pm | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 5fc26a97..08ffce0c 100644 --- a/urpm.pm +++ b/urpm.pm @@ -2210,25 +2210,30 @@ sub get_source_packages { if (my ($filename) = /^([^\/]*\.rpm)$/) { my $filepath = "$urpm->{cachedir}/rpms/$filename"; if (!$options{clean_all} && -s $filepath) { - if (exists $usefull_files{$filename} && URPM::verify_rpm($filepath, nogpg => 1, nopgp => 1) =~ /md5 OK/) { - if (keys(%{$file2fullnames{$filename} || {}}) > 1) { - $urpm->{error}(N("there are multiple packages with the same rpm filename \"%s\""), $filename); - next; - } elsif (keys(%{$file2fullnames{$filename} || {}}) == 1) { - my ($fullname) = keys(%{$file2fullnames{$filename} || {}}); - if (defined($id = delete $fullname2id{$fullname})) { - $local_sources{$id} = $filepath; + if (exists $usefull_files{$filename}) { + if (URPM::verify_rpm($filepath, nogpg => 1, nopgp => 1) =~ /md5 OK/) { + if (keys(%{$file2fullnames{$filename} || {}}) > 1) { + $urpm->{error}(N("there are multiple packages with the same rpm filename \"%s\""), $filename); + next; + } elsif (keys(%{$file2fullnames{$filename} || {}}) == 1) { + my ($fullname) = keys(%{$file2fullnames{$filename} || {}}); + if (defined($id = delete $fullname2id{$fullname})) { + $local_sources{$id} = $filepath; + } else { + $options{clean_other} and unlink $filepath; + } } else { $options{clean_other} and unlink $filepath; } } else { - $options{clean_other} and unlink $filepath; + #- this is an invalid file in cache, remove it and ignore it. + #- or clean options has been given meaning ignore any file in cache + #- remove it too. + unlink $filepath; } } #- do not examine rpm file in cache that will not be used. } else { - #- this is an invalid file in cache, remove it and ignore it. - #- or clean options has been given meaning ignore any file in cache - #- remove it too. + #- this file should be removed or is already empty. unlink $filepath; } } #- no error on unknown filename located in cache (because .listing) -- cgit v1.2.1