From 356c04bab9f652034b82462b49bdfafc440c627b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 17 Sep 2007 09:06:25 +0000 Subject: - fix using already downloaded rpms (from /var/cache/urpmi/rpms) (#33655) --- urpm/get_pkgs.pm | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'urpm') diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index e5a842ac..401faa30 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, %id_map); + my (%protected_files, %local_sources, %fullname2id); #- build association hash to retrieve id and examine all list files. foreach (keys %$packages) { @@ -33,16 +33,7 @@ sub selected2list { my $file = $local_sources{$id} = $urpm->{source}{$id}; $protected_files{$file} = undef; } else { - 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; + $fullname2id{$urpm->{depslist}[$id]->fullname} = $id; } } } @@ -64,7 +55,21 @@ sub selected2list { } } - my @remaining_ids = sort { $a <=> $b } map { @$_ } values %fullname2id; + my (%id_map, @remaining_ids); + foreach my $id (values %fullname2id) { + 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 @remaining_ids, @pkgs; + } + + @remaining_ids = sort { $a <=> $b } @remaining_ids; my @list = map { my $medium = $_; -- cgit v1.2.1