diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-01-09 14:41:50 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-01-09 14:41:50 +0000 |
commit | a35ee8d4f42b65e84f0824166d9e8ac50af6c981 (patch) | |
tree | 2b8b31a3059f85d710a635f1406160a119df9edf /urpm/get_pkgs.pm | |
parent | fd71fc58b8a72fbe26077849e65efaddadbd1b51 (diff) | |
download | urpmi-a35ee8d4f42b65e84f0824166d9e8ac50af6c981.tar urpmi-a35ee8d4f42b65e84f0824166d9e8ac50af6c981.tar.gz urpmi-a35ee8d4f42b65e84f0824166d9e8ac50af6c981.tar.bz2 urpmi-a35ee8d4f42b65e84f0824166d9e8ac50af6c981.tar.xz urpmi-a35ee8d4f42b65e84f0824166d9e8ac50af6c981.zip |
When downloading packages, remember where it comes from.
When the same packages is available from different medias (main/release
and main/update for example), urpmi can forget from which media it
downloaded the package, and this causes issues with key checking. This
commit makes sure we are using the right package id for the package we
downloaded (the same package will have different IDs if it's available
from different medias).
Diffstat (limited to 'urpm/get_pkgs.pm')
-rw-r--r-- | urpm/get_pkgs.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index d0cb60f1..972e1fba 100644 --- a/urpm/get_pkgs.pm +++ b/urpm/get_pkgs.pm @@ -173,6 +173,7 @@ sub download_packages_of_distant_media { my ($urpm, $blists, $sources, $error_sources, %options) = @_; my %errors; + my %new_sources; #- get back all ftp and http accessible rpm files into the local cache foreach my $blist (@$blists) { @@ -182,10 +183,11 @@ sub download_packages_of_distant_media { while (my ($id, $pkg) = each %{$blist->{pkgs}}) { #- the given URL is trusted, so the file can safely be ignored. defined $sources->{$id} and next; + exists $new_sources{$id} and next; if (urpm::is_local_medium($blist->{medium})) { my $local_file = file_from_local_url(urpm::blist_pkg_to_url($blist, $pkg)); if (-r $local_file) { - $sources->{$id} = $local_file; + $new_sources{$id} = [ $pkg->id, $local_file ]; } else { $errors{$id} = [ $local_file, 'missing' ]; } @@ -196,13 +198,18 @@ sub download_packages_of_distant_media { if (%{$blist_distant{pkgs}}) { my ($remote_sources, $remote_errors) = _download_packages_of_distant_media($urpm, \%blist_distant, %options); - put_in_hash ($sources, $remote_sources); + put_in_hash (\%new_sources, $remote_sources); put_in_hash (\%errors, $remote_errors); } } #- clean failed download which have succeeded. - delete @errors{keys %$sources}; + delete @errors{keys %$sources, keys %new_sources}; + + foreach (values %new_sources) { + my ($id, $local_file) = @$_; + $sources->{$id} = $local_file; + } push @$error_sources, values %errors; @@ -239,7 +246,7 @@ sub _download_packages_of_distant_media { my $url = urpm::blist_pkg_to_url($blist, $pkg); if ($filename && -s "$cachedir/partial/$filename") { if (my $rpm = verify_partial_rpm_and_move($urpm, $cachedir, $filename)) { - $sources{$id} = $rpm; + $sources{$id} = [ $pkg->id, $rpm ]; } else { $errors{$id} = [ $url, 'bad' ]; } |