summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-13 17:15:54 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-13 17:15:54 +0000
commitc445903598110aa7611a29acda82936ea450cc8e (patch)
treed65acf02574f723abc69799d4365785c4aa64eee
parent30cab8dbf055736db8adcf5c2106ace053b8c8b8 (diff)
downloadurpmi-c445903598110aa7611a29acda82936ea450cc8e.tar
urpmi-c445903598110aa7611a29acda82936ea450cc8e.tar.gz
urpmi-c445903598110aa7611a29acda82936ea450cc8e.tar.bz2
urpmi-c445903598110aa7611a29acda82936ea450cc8e.tar.xz
urpmi-c445903598110aa7611a29acda82936ea450cc8e.zip
create remove_media out of remove_selected_media, and cleanup
-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.