summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-14 11:36:21 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-14 11:36:21 +0000
commit491e4c789ebc4dd957aa516dae68bc18df905b09 (patch)
treeac1f71c3c1f14d5fdeb3ae5f4b6712826c923c00 /urpm.pm
parentcc2589e748dbe55e95fad31acb2673ca5063ae28 (diff)
downloadurpmi-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.pm19
1 files changed, 5 insertions, 14 deletions
diff --git a/urpm.pm b/urpm.pm
index 93afd739..7d274db2 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -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;