summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-12 13:49:45 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-12 13:49:45 +0000
commit1c7104669163e6926748aa41261686966691f87c (patch)
tree2b36c3139abbb5f6e3e63295fe98918b584eca16
parentb095172ad19310bf2253acf8f1fdf7b9a88483a1 (diff)
downloadurpmi-1c7104669163e6926748aa41261686966691f87c.tar
urpmi-1c7104669163e6926748aa41261686966691f87c.tar.gz
urpmi-1c7104669163e6926748aa41261686966691f87c.tar.bz2
urpmi-1c7104669163e6926748aa41261686966691f87c.tar.xz
urpmi-1c7104669163e6926748aa41261686966691f87c.zip
previous commit was making some wrong assumptions when simplifying
selected2list(). it needs to be a little more complex...
-rw-r--r--urpm/get_pkgs.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index 071a4dbe..e5a842ac 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -24,7 +24,7 @@ sub clean_all_cache {
#- associated to a null list.
sub selected2list {
my ($urpm, $packages, %options) = @_;
- my (%protected_files, %local_sources, %fullname2id);
+ my (%protected_files, %local_sources, %fullname2id, %id_map);
#- build association hash to retrieve id and examine all list files.
foreach (keys %$packages) {
@@ -33,7 +33,16 @@ sub selected2list {
my $file = $local_sources{$id} = $urpm->{source}{$id};
$protected_files{$file} = undef;
} else {
- $fullname2id{$urpm->{depslist}[$id]->fullname} = $id;
+ my $pkg = $urpm->{depslist}[$id];
+ my $fullname = $pkg->fullname;
+ my @pkgs = map { $_->id } grep { $fullname eq $_->fullname } $urpm->packages_by_name($pkg->name);
+
+ # id_map is a remapping of id.
+ # it is needed because @list must be [ { id => pkg } ] where id is one the selected id,
+ # not really the real package id
+ $id_map{$_} = $id foreach @pkgs;
+
+ push @{$fullname2id{$fullname2id}}, @pkgs;
}
}
}
@@ -55,7 +64,7 @@ sub selected2list {
}
}
- my @remaining_ids = sort { $a <=> $b } values %fullname2id;
+ my @remaining_ids = sort { $a <=> $b } map { @$_ } values %fullname2id;
my @list = map {
my $medium = $_;
@@ -68,7 +77,7 @@ sub selected2list {
my $pkg = $urpm->{depslist}[$id];
if ($pkg->filename !~ /\.delta\.rpm$/ || $urpm->is_delta_installable($pkg, $urpm->{root})) {
- $sources{$id} = "$medium->{url}/" . $pkg->filename;
+ $sources{$id_map{$id}} = "$medium->{url}/" . $pkg->filename;
}
}
}