From e22a7e6f6d267b8d7cf2c6c188cdcbd7d703a49a Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 20 Oct 2008 09:03:20 +0000 Subject: make things more clear: do not "delete $medium->{key-ids}" to ensure we don't loose key-ids for media we don't update (??) --- urpm/media.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/urpm/media.pm b/urpm/media.pm index 3a21a0aa..46cd959a 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -1516,8 +1516,9 @@ sub _get_pubkey { $urpm->{modified} = 1; } +# options: wait_lock, nopubkey, forcekey sub _get_pubkey_and_descriptions { - my ($urpm, $medium, $nopubkey, $b_wait_lock) = @_; + my ($urpm, $medium, %options) = @_; my $local = file_from_local_medium($medium); @@ -1526,7 +1527,7 @@ sub _get_pubkey_and_descriptions { ($local ? \&get_descriptions_local : \&get_descriptions_remote)->($urpm, $medium); } - _get_pubkey($urpm, $medium, $b_wait_lock) if !$nopubkey && !$medium->{'key-ids'}; + _get_pubkey($urpm, $medium, $options{wait_lock}) if !$options{nopubkey} && (!$medium->{'key-ids'} || $options{forcekey}); } sub _read_cachedir_pubkey { @@ -1576,12 +1577,9 @@ sub _update_medium_ { ? _update_medium__parse_if_unmodified__local($urpm, $medium, \%options) : _update_medium__parse_if_unmodified__remote($urpm, $medium, \%options); - if ($options{forcekey}) { - delete $medium->{'key-ids'}; - if ($rc eq 'unmodified') { - _get_pubkey($urpm, $medium); # we must do it now, quite hackish... - return 1; - } + if ($options{forcekey} && $rc eq 'unmodified') { + _get_pubkey($urpm, $medium); # we must do it now, quite hackish... + return 1; } if (!$rc || $rc eq 'unmodified') { @@ -1623,7 +1621,7 @@ sub _update_medium_ { # generated on first _parse_media() unlink statedir_names($urpm, $medium); - _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey}, $options{wait_lock}); + _get_pubkey_and_descriptions($urpm, $medium, %options); $is_updating and $urpm->{info}(N("updated medium \"%s\"", $medium->{name})); -- cgit v1.2.1