summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-05-12 09:39:44 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-05-12 09:39:44 +0000
commit9b571e0095c6ca8a97df7144ca4db3bd92514733 (patch)
tree859a91e9a67997ca3ffe7775dc9e944f0f6b1506
parent90e83c0ec23d1494967acd6a8e13104f3dc43a4b (diff)
downloadurpmi-9b571e0095c6ca8a97df7144ca4db3bd92514733.tar
urpmi-9b571e0095c6ca8a97df7144ca4db3bd92514733.tar.gz
urpmi-9b571e0095c6ca8a97df7144ca4db3bd92514733.tar.bz2
urpmi-9b571e0095c6ca8a97df7144ca4db3bd92514733.tar.xz
urpmi-9b571e0095c6ca8a97df7144ca4db3bd92514733.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).
-rw-r--r--NEWS3
-rw-r--r--urpm/get_pkgs.pm25
2 files changed, 21 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 6016bcd0..3ca99532 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- urpmi
+ o fix issue with urpmi sometimes using the wrong key when checking
+ signatures when the same package is available from different media
- urpmi_rpm-find-leaves
o do not list suggested packages as unrequested packages (#46326)
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index 9fb81b83..adf776d4 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -170,6 +170,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) {
@@ -179,10 +180,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' ];
}
@@ -192,12 +194,19 @@ sub download_packages_of_distant_media {
}
if (%{$blist_distant{pkgs}}) {
- _download_packages_of_distant_media($urpm, $sources, \%errors, \%blist_distant, %options);
+ my ($remote_sources, $remote_errors) = _download_packages_of_distant_media($urpm, \%blist_distant, %options);
+ 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;
@@ -206,9 +215,10 @@ sub download_packages_of_distant_media {
sub _download_packages_of_distant_media {
- my ($urpm, $sources, $errors, $blist, %options) = @_;
+ my ($urpm, $blist, %options) = @_;
my $cachedir = urpm::valid_cachedir($urpm);
+ my (%sources, %errors);
$urpm->{log}(N("retrieving rpm files from medium \"%s\"...", $blist->{medium}{name}));
if (urpm::download::sync_rel($urpm, $blist->{medium}, [ urpm::blist_to_filenames($blist) ],
@@ -232,14 +242,15 @@ 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' ];
+ $errors{$id} = [ $url, 'bad' ];
}
} else {
- $errors->{$id} = [ $url, 'missing' ];
+ $errors{$id} = [ $url, 'missing' ];
}
}
+ (\%sources, \%errors)
}
1;