diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-14 11:36:21 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-14 11:36:21 +0000 |
commit | 491e4c789ebc4dd957aa516dae68bc18df905b09 (patch) | |
tree | ac1f71c3c1f14d5fdeb3ae5f4b6712826c923c00 /urpm.pm | |
parent | cc2589e748dbe55e95fad31acb2673ca5063ae28 (diff) | |
download | urpmi-491e4c789ebc4dd957aa516dae68bc18df905b09.tar urpmi-491e4c789ebc4dd957aa516dae68bc18df905b09.tar.gz urpmi-491e4c789ebc4dd957aa516dae68bc18df905b09.tar.bz2 urpmi-491e4c789ebc4dd957aa516dae68bc18df905b09.tar.xz urpmi-491e4c789ebc4dd957aa516dae68bc18df905b09.zip |
simplify code using select_media_by_name()
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -560,25 +560,16 @@ sub configure { } if ($options{excludemedia}) { delete $_->{modified} foreach @{$urpm->{media} || []}; - $urpm->select_media(split /,/, $options{excludemedia}); - foreach (grep { $_->{modified} } @{$urpm->{media} || []}) { + foreach (select_media_by_name($urpm, [ split /,/, $options{excludemedia} ], {})) { + $_->{modified} = 1; #- this is only a local ignore that will not be saved. $_->{tempignore} = $_->{ignore} = 1; } } if ($options{sortmedia}) { - delete $_->{modified} foreach @{$urpm->{media} || []}; - my @oldmedia = @{$urpm->{media} || []}; - my @newmedia; - foreach (split /,/, $options{sortmedia}) { - $urpm->select_media($_); - push @newmedia, grep { $_->{modified} } @oldmedia; - @oldmedia = grep { !$_->{modified} } @oldmedia; - } - #- anything not selected should be added here, as it's after the selected ones. - $urpm->{media} = [ @newmedia, @oldmedia ]; - #- forget remaining modified flags. - delete $_->{modified} foreach @{$urpm->{media} || []}; + my @sorted_media = map { select_media_by_name($urpm, [$_], {}) } split(/,/, $options{sortmedia}); + my @remaining = difference2($urpm->{media}, \@sorted_media); + $urpm->{media} = [ @sorted_media, @remaining ]; } unless ($options{nodepslist}) { my $second_pass; |