From 002651e9da33b6ded7cf38fe95ca6441fa5ac74d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 10 Jan 2007 16:36:38 +0000 Subject: simplify --- urpm/get_pkgs.pm | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'urpm') diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index 80210457..b2f4ad68 100644 --- a/urpm/get_pkgs.pm +++ b/urpm/get_pkgs.pm @@ -43,19 +43,16 @@ sub selected2list { if (! -s $filepath) { unlink $filepath; #- this file should be removed or is already empty. } else { - my $filename = basename($filepath); - if (keys(%{$file2fullnames{$filename} || {}}) > 1) { - $urpm->{error}(N("there are multiple packages with the same rpm filename \"%s\"", $filename)); - } elsif (keys(%{$file2fullnames{$filename} || {}}) == 1) { - my ($fullname) = keys(%{$file2fullnames{$filename} || {}}); - if (defined(my $id = delete $fullname2id{$fullname})) { - $local_sources{$id} = $filepath; - } else { - $options{clean_other} && ! exists $protected_files{$filepath} and unlink $filepath; - } - } else { - $options{clean_other} && ! exists $protected_files{$filepath} and unlink $filepath; - } + my $filename = basename($filepath); + my @fullnames = keys(%{$file2fullnames{$filename} || {}}); + if (@fullnames > 1) { + $urpm->{error}(N("there are multiple packages with the same rpm filename \"%s\"", $filename)); + } elsif (@fullnames == 1 && + defined(my $id = delete $fullname2id{$fullnames[0]})) { + $local_sources{$id} = $filepath; + } else { + $options{clean_other} && ! exists $protected_files{$filepath} and unlink $filepath; + } } } -- cgit v1.2.1