summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-26 19:53:35 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-26 19:53:35 +0000
commit66613b37f254e96b63fe807a9b434dcadc3e5cb3 (patch)
tree26a76447d0e262d5a50d8f4b7355f764da733dd5 /urpm
parentdecf6c5f3f26024549b5bcb280e6e5713a21250e (diff)
downloadurpmi-66613b37f254e96b63fe807a9b434dcadc3e5cb3.tar
urpmi-66613b37f254e96b63fe807a9b434dcadc3e5cb3.tar.gz
urpmi-66613b37f254e96b63fe807a9b434dcadc3e5cb3.tar.bz2
urpmi-66613b37f254e96b63fe807a9b434dcadc3e5cb3.tar.xz
urpmi-66613b37f254e96b63fe807a9b434dcadc3e5cb3.zip
create _filepath() to remove duplicated code
Diffstat (limited to 'urpm')
-rw-r--r--urpm/removable.pm14
1 files changed, 10 insertions, 4 deletions
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...