summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm.pm18
1 files changed, 10 insertions, 8 deletions
diff --git a/urpm.pm b/urpm.pm
index 94c68a23..93afd739 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -864,6 +864,7 @@ sub add_distrib_media {
return @newnames;
}
+#- deprecated, use select_media_by_name instead
sub select_media {
my $urpm = shift;
my $options = {};
@@ -909,12 +910,17 @@ sub select_media_by_name {
@l;
}
+#- deprecated, use remove_media instead
sub remove_selected_media {
my ($urpm) = @_;
- my @result;
- foreach (@{$urpm->{media}}) {
- if ($_->{modified}) {
+ remove_media($urpm, [ grep { $_->{modified} } @{$urpm->{media}} ]);
+}
+
+sub remove_media {
+ my ($urpm, $to_remove) = @_;
+
+ foreach (@$to_remove) {
$urpm->{log}(N("removing medium \"%s\"", $_->{name}));
#- mark to re-write configuration.
@@ -928,13 +934,9 @@ sub remove_selected_media {
#- remove proxy settings for this media
urpm::download::remove_proxy_media($_->{name});
- } else {
- push @result, $_; #- not removed so keep it
- }
}
- #- restore newer media list.
- $urpm->{media} = \@result;
+ $urpm->{media} = [ difference2($urpm->{media}, $to_remove) ];
}
#- return list of synthesis or hdlist reference to probe.