summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-08 18:59:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-08 18:59:28 +0000
commit263c73c0aca9e61eff0f4d357e404bacbb2db4e6 (patch)
tree419ad800578f994f0064e5ad5c850d25dbc8515a
parent75d8cd0b15bde3504b5d2d1b66fae04344e1ed2b (diff)
downloadurpmi-263c73c0aca9e61eff0f4d357e404bacbb2db4e6.tar
urpmi-263c73c0aca9e61eff0f4d357e404bacbb2db4e6.tar.gz
urpmi-263c73c0aca9e61eff0f4d357e404bacbb2db4e6.tar.bz2
urpmi-263c73c0aca9e61eff0f4d357e404bacbb2db4e6.tar.xz
urpmi-263c73c0aca9e61eff0f4d357e404bacbb2db4e6.zip
make selected2list() use selected2local_and_blists()
and make selected2local_and_blists() do the computation
-rw-r--r--urpm/get_pkgs.pm31
1 files changed, 14 insertions, 17 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index b632839f..5edb1548 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -92,7 +92,7 @@ sub _selected2local_and_ids {
(\%local_sources, \%id2ids);
}
-sub selected2list {
+sub selected2local_and_blists {
my ($urpm, $selected, %options) = @_;
my ($local_sources, $id2ids) = _selected2local_and_ids($urpm, $selected, %options);
@@ -107,7 +107,7 @@ sub selected2list {
my @remaining_ids = sort { $a <=> $b } keys %id_map;
- my @list = map {
+ my @blists = map {
my $medium = $_;
my %sources;
if (urpm::media::is_valid_medium($medium) && !$medium->{ignore}) {
@@ -120,7 +120,7 @@ sub selected2list {
$sources{$id_map{$id}} = "$medium->{url}/" . $pkg->filename;
}
}
- \%sources;
+ %sources ? { medium => $medium, list => \%sources } : ();
} (@{$urpm->{media} || []});
if (@remaining_ids) {
@@ -128,29 +128,26 @@ sub selected2list {
return;
}
- ($local_sources, \@list);
+ ($local_sources, \@blists);
}
#- side-effects: none
-sub _create_blists {
- my ($media, $list) = @_;
-
- #- make sure everything is correct on input...
- $media or return;
- @$media == @$list or return;
+sub _create_old_list_from_blists {
+ my ($media, $blists) = @_;
- my $i;
- [ map {
- my $list = $list->[$i++];
- %$list ? { medium => $_, list => $list } : ();
+ [ map {
+ my $medium = $_;
+ my ($blist) = grep { $_->{medium} == $medium } @$blists;
+ $blist->{list};
} @$media ];
}
-sub selected2local_and_blists {
+# deprecated, use selected2local_and_blists() instead
+sub selected2list {
my ($urpm, $selected, %options) = @_;
- my ($local_sources, $list) = selected2local_and_blists($urpm, $selected, %options);
- ($local_sources, _create_blists($urpm->{media}, $list));
+ my ($local_sources, $blists) = selected2local_and_blists($urpm, $selected, %options);
+ ($local_sources, _create_old_list_from_blists($urpm->{media}, $blists));
}
sub verify_partial_rpm_and_move {