From e4eabb750ba17ea9ac9d63e4bbff66c2f6605c2c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 21 Nov 2006 12:13:34 +0000 Subject: create _get_pubkey_and_descriptions() out of various code that was done in the middle of code parsing hdlist/synthesis --- urpm.pm | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index e5a4096e..b288c6d2 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1485,8 +1485,6 @@ this could happen if you mounted manually the directory when creating the medium _parse_hdlist_or_synthesis__virtual($urpm, $medium); } - get_descriptions_local($urpm, $medium); - #- examine if a distant MD5SUM file is available. #- this will only be done if $with_hdlist is not empty in order to use #- an existing hdlist or synthesis file, and to check if download was good. @@ -1539,11 +1537,6 @@ this could happen if you mounted manually the directory when creating the medium } } - #- examine if a local pubkey file is available. - if (!$options->{nopubkey} && !$medium->{'key-ids'}) { - _get_list_or_pubkey__local($urpm, $medium, 'pubkey'); - } - 1; } @@ -1552,8 +1545,6 @@ sub _update_medium__parse_if_unmodified__or_get_files__remote { my ($urpm, $medium, $options) = @_; my ($retrieved_md5sum, $basename); - get_descriptions_remote($urpm, $medium); - #- examine if a distant MD5SUM file is available. #- this will only be done if $with_hdlist is not empty in order to use #- an existing hdlist or synthesis file, and to check if download was good. @@ -1639,11 +1630,6 @@ sub _update_medium__parse_if_unmodified__or_get_files__remote { #- the files are different, update local copy. rename("$urpm->{cachedir}/partial/$basename", cachedir_hdlist($urpm, $medium)); - - #- retrieve pubkey file. - if (!$options->{nopubkey} && !$medium->{'key-ids'}) { - _get_list_or_pubkey__remote($urpm, $medium, 'pubkey'); - } } else { $options->{callback} and $options->{callback}('failed', $medium->{name}); $urpm->{error}(N("retrieval of source hdlist (or synthesis) failed")); @@ -1653,6 +1639,19 @@ sub _update_medium__parse_if_unmodified__or_get_files__remote { 1; } +sub _get_pubkey_and_descriptions { + my ($urpm, $medium, $nopubkey) = @_; + + my $local = file_from_local_url($medium->{url}); + + ($local ? \&get_descriptions_local : \&get_descriptions_remote)->($urpm, $medium); + + #- examine if a pubkey file is available. + if (!$nopubkey && !$medium->{'key-ids'}) { + ($local ? \&_get_list_or_pubkey__local : \&_get_list_or_pubkey__remote)->($urpm, $medium, 'pubkey'); + } +} + sub _read_cachedir_pubkey { my ($urpm, $medium) = @_; -s "$urpm->{cachedir}/partial/pubkey" or return; @@ -1781,6 +1780,8 @@ sub _update_medium_first_pass { } } + _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey}); + _read_cachedir_pubkey($urpm, $medium); unless ($medium->{virtual}) { -- cgit v1.2.1