From a35ee8d4f42b65e84f0824166d9e8ac50af6c981 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Fri, 9 Jan 2009 14:41:50 +0000 Subject: 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). --- NEWS | 2 ++ urpm/get_pkgs.pm | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 4756385c..a677b789 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ o do not list suggested packages as unrequested packages (#46326) - urpmq o fix urpmq -i on local RPMs + o fix issue with urpmi sometimes using the wrong key when checking + signatures when the same package is available from different media Version 6.19 - 24 November 2008 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' ]; } -- cgit v1.2.1