diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-13 17:15:54 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-13 17:15:54 +0000 |
commit | c445903598110aa7611a29acda82936ea450cc8e (patch) | |
tree | d65acf02574f723abc69799d4365785c4aa64eee | |
parent | 30cab8dbf055736db8adcf5c2106ace053b8c8b8 (diff) | |
download | urpmi-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.pm | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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. |