From e150804292cf6f19c2a37b08ccd1b5989e1a584c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 13 Nov 2006 11:40:22 +0000 Subject: simplify $check_notfound in copy_packages_of_removable_media --- urpm.pm | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/urpm.pm b/urpm.pm index 50a63a4b..eb46bab3 100644 --- a/urpm.pm +++ b/urpm.pm @@ -2624,22 +2624,21 @@ sub copy_packages_of_removable_media { #- examine if given medium is already inside a removable device. my $check_notfound = sub { my ($id, $dir, $removable) = @_; - $dir and $urpm->try_mounting($dir, $removable); - if (!$dir || -e $dir) { - foreach (values %{$list->[$id]}) { - chomp; - my $dir_ = analyse_url__file_if_local($_) or next; - $dir_ =~ m!/.*/! or next; #- is this really needed?? - unless ($dir) { - $dir = $dir_; - $urpm->try_mounting($dir, $removable); - } - -r $dir_ or return 1; + if ($dir) { + $urpm->try_mounting($dir, $removable); + -e $dir or return 2; + } + foreach (values %{$list->[$id]}) { + chomp; + my $dir_ = analyse_url__file_if_local($_) or next; + $dir_ =~ m!/.*/! or next; #- is this really needed?? + unless ($dir) { + $dir = $dir_; + $urpm->try_mounting($dir, $removable); } - } else { - return 2; + -r $dir_ or return 1; } - return 0; + 0; }; #- removable media have to be examined to keep mounted the one that has #- more packages than others. -- cgit v1.2.1