From 66613b37f254e96b63fe807a9b434dcadc3e5cb3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 26 Feb 2008 19:53:35 +0000 Subject: create _filepath() to remove duplicated code --- urpm/removable.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'urpm') diff --git a/urpm/removable.pm b/urpm/removable.pm index 66e696c3..569724f2 100644 --- a/urpm/removable.pm +++ b/urpm/removable.pm @@ -88,8 +88,7 @@ sub _check_notfound { } foreach (values %$medium_list) { chomp; - my $dir_ = file_from_local_url($_) or next; - $dir_ =~ m!/.*/! or next; #- is this really needed?? + my $dir_ = _filepath($_) or next; if (!$dir) { $dir = $dir_; try_mounting($urpm, $dir, $removable); @@ -133,6 +132,14 @@ sub _mount_it { } } +sub _filepath { + my ($url) = @_; + + my $filepath = file_from_local_url($url) or return; + $filepath =~ m!/.*/! or return; #- is this really needed?? + $filepath; +} + sub _examine_removable_medium_ { my ($urpm, $medium, $medium_list, $sources, $device, $o_ask_for_medium) = @_; @@ -143,8 +150,7 @@ sub _examine_removable_medium_ { if (-e $dir) { while (my ($i, $url) = each %$medium_list) { chomp $url; - my $filepath = file_from_local_url($url) or next; - $filepath =~ m!/.*/! or next; #- is this really needed?? + my $filepath = _filepath($url) or next; if (-r $filepath) { #- we should assume a possibly buggy removable device... -- cgit v1.2.1