From cd07c34929ce9da30fdd4517b58e42df63ae3127 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 20 Oct 2008 08:48:51 +0000 Subject: move some code into _get_pubkey() (for next commits) --- urpm/media.pm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/urpm/media.pm b/urpm/media.pm index 1cf99072..6f6c2a5e 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -1504,8 +1504,19 @@ sub _update_medium__parse_if_unmodified__remote { 1; } +sub _get_pubkey { + my ($urpm, $medium, $b_wait_lock) = @_; + + my $local = file_from_local_medium($medium); + + #- examine if a pubkey file is available. + ($local ? \&_get_pubkey__local : \&_download_pubkey)->($urpm, $medium); + + $medium->{'key-ids'} =_read_cachedir_pubkey($urpm, $medium, $b_wait_lock); +} + sub _get_pubkey_and_descriptions { - my ($urpm, $medium, $nopubkey) = @_; + my ($urpm, $medium, $nopubkey, $b_wait_lock) = @_; my $local = file_from_local_medium($medium); @@ -1514,10 +1525,7 @@ sub _get_pubkey_and_descriptions { ($local ? \&get_descriptions_local : \&get_descriptions_remote)->($urpm, $medium); } - #- examine if a pubkey file is available. - if (!$nopubkey && !$medium->{'key-ids'}) { - ($local ? \&_get_pubkey__local : \&_download_pubkey)->($urpm, $medium); - } + _get_pubkey($urpm, $medium, $b_wait_lock) if !$nopubkey && !$medium->{'key-ids'}; } sub _read_cachedir_pubkey { @@ -1606,8 +1614,7 @@ sub _update_medium_ { # generated on first _parse_media() unlink statedir_names($urpm, $medium); - _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey}); - $medium->{'key-ids'} ||= _read_cachedir_pubkey($urpm, $medium, $options{wait_lock}); + _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey}, $options{wait_lock}); $is_updating and $urpm->{info}(N("updated medium \"%s\"", $medium->{name})); -- cgit v1.2.1