summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-26 19:28:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-26 19:28:51 +0000
commit98a27c2141b2ef3ba6f1a191aac672350c318fa1 (patch)
treea97fbbc55ee5f907cf59a695c9693a1e564bb85e
parenta6f2d3d26b5603350d49b03004879bb853575378 (diff)
downloadurpmi-98a27c2141b2ef3ba6f1a191aac672350c318fa1.tar
urpmi-98a27c2141b2ef3ba6f1a191aac672350c318fa1.tar.gz
urpmi-98a27c2141b2ef3ba6f1a191aac672350c318fa1.tar.bz2
urpmi-98a27c2141b2ef3ba6f1a191aac672350c318fa1.tar.xz
urpmi-98a27c2141b2ef3ba6f1a191aac672350c318fa1.zip
create _get_removables_or_check_mounted() out of copy_packages_of_removable_media()
-rw-r--r--urpm/removable.pm25
1 files changed, 17 insertions, 8 deletions
diff --git a/urpm/removable.pm b/urpm/removable.pm
index 28fb553e..cbd56ed2 100644
--- a/urpm/removable.pm
+++ b/urpm/removable.pm
@@ -151,15 +151,10 @@ sub _examine_removable_medium {
}
}
-#- $list is a [ { pkg_id1 => url1, ... }, { ... }, ... ]
-#- where there is one hash for each medium in {media}
-sub copy_packages_of_removable_media {
- my ($urpm, $list, $sources, $o_ask_for_medium) = @_;
- my %removables;
+sub _get_removables_or_check_mounted {
+ my ($urpm, $list) = @_;
- #- make sure everything is correct on input...
- $urpm->{media} or return;
- @{$urpm->{media}} == @$list or return;
+ my %removables;
foreach (0..$#$list) {
values %{$list->[$_]} or next;
@@ -172,6 +167,20 @@ sub copy_packages_of_removable_media {
$urpm->{error}(N("unable to access medium \"%s\"", $medium->{name})), next;
}
}
+ %removables;
+}
+
+#- $list is a [ { pkg_id1 => url1, ... }, { ... }, ... ]
+#- where there is one hash for each medium in {media}
+sub copy_packages_of_removable_media {
+ my ($urpm, $list, $sources, $o_ask_for_medium) = @_;
+
+ #- make sure everything is correct on input...
+ $urpm->{media} or return;
+ @{$urpm->{media}} == @$list or return;
+
+ my %removables = _get_removables_or_check_mounted($urpm, $list);
+
foreach my $device (keys %removables) {
next if $device =~ m![^a-zA-Z0-9_./-]!; #- bad path
#- Here we have only removable devices.