summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-10-05 01:20:14 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-10-05 01:20:14 +0000
commit02da42575b89e9cddc2d55c79710a086a21f598e (patch)
tree4e65206a64ab061683c47dba727cbb9937bdf951
parent7e9dc45cf9ee9971f81cc7fbc2859aec453c9a2b (diff)
downloadurpmi-02da42575b89e9cddc2d55c79710a086a21f598e.tar
urpmi-02da42575b89e9cddc2d55c79710a086a21f598e.tar.gz
urpmi-02da42575b89e9cddc2d55c79710a086a21f598e.tar.bz2
urpmi-02da42575b89e9cddc2d55c79710a086a21f598e.tar.xz
urpmi-02da42575b89e9cddc2d55c79710a086a21f598e.zip
Really take media into account in the order in which they are specified
in the urpmi.cfg file.
-rw-r--r--urpm.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/urpm.pm b/urpm.pm
index e5eada2a..beb56b00 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -178,6 +178,8 @@ sub read_config {
$urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium;
}
+ $urpm->{media} = [ sort { $a->{priority} <=> $b->{priority} } @{$urpm->{media}} ];
+
#- keep in mind when an hdlist/list file is already used
my %filelists;
foreach (@{$urpm->{media}}) {
@@ -466,14 +468,14 @@ sub configure {
delete $_->{modified} foreach @{$urpm->{media} || []};
my @oldmedia = @{$urpm->{media} || []};
my @newmedia;
- foreach (split ',', $options{sortmedia}) {
+ foreach (split /,/, $options{sortmedia}) {
$urpm->select_media($_);
push @newmedia, grep { $_->{modified} } @oldmedia;
@oldmedia = grep { !$_->{modified} } @oldmedia;
}
- #- anything not selected should be added as is after the selected one.
+ #- anything not selected should be added here, as it's after the selected ones.
$urpm->{media} = [ @newmedia, @oldmedia ];
- #- clean remaining modified flag.
+ #- clean remaining modified flags.
delete $_->{modified} foreach @{$urpm->{media} || []};
}
unless ($options{nodepslist}) {
@@ -747,13 +749,12 @@ sub select_media {
my $urpm = shift;
my $options = {};
if (ref $_[0]) { $options = shift }
- my %media; @media{@_} = undef;
+ my %media; @media{@_} = ();
foreach (@{$urpm->{media}}) {
if (exists($media{$_->{name}})) {
- $media{$_->{name}} = 1; #- keep it mind this one has been selected.
-
- #- select medium by setting modified flags, do not check ignore.
+ $media{$_->{name}} = 1; #- keep in mind this one has been selected.
+ #- select medium by setting the modified flag, do not check ignore.
$_->{modified} = 1;
}
}