From 50f7703a27e4ca409e999dcc2fdd156dc0adbc7b Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 10 Dec 2004 11:24:43 +0000 Subject: Factorize the code that guesses the pubkey file name. Use the rpm pubkey for the associated srpm media. --- urpm.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/urpm.pm b/urpm.pm index 1adf1ecd..3379498c 100644 --- a/urpm.pm +++ b/urpm.pm @@ -914,6 +914,11 @@ sub _guess_hdlist_suffix { $suffix; } +sub _guess_pubkey_name { + my ($medium) = @_; + return $medium->{with_hdlist} =~ /hdlist(.*?)(?:\.src)?\.cz2?$/ ? "pubkey$1" : 'pubkey'; +} + #- Update the urpmi database w.r.t. the current configuration. #- Takes care of modifications, and tries some tricks to bypass #- the recomputation of base files. @@ -1297,8 +1302,7 @@ 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->{hdlist} ne 'pubkey' && !$medium->{'key-ids'}) { - my $local_pubkey = $medium->{with_hdlist} =~ /hdlist(.*)\.cz2?$/ ? "pubkey$1" : 'pubkey'; - my $path_pubkey = reduce_pathname("$with_hdlist_dir/../$local_pubkey"); + my $path_pubkey = reduce_pathname("$with_hdlist_dir/../" . _guess_pubkey_name($medium)); -e $path_pubkey or $path_pubkey = "$dir/pubkey"; if ($path_pubkey) { urpm::util::copy($path_pubkey, "$urpm->{cachedir}/partial/pubkey") @@ -1582,7 +1586,7 @@ this could happen if you mounted manually the directory when creating the medium #- retrieve pubkey file. if (!$options{nopubkey} && $medium->{hdlist} ne 'pubkey' && !$medium->{'key-ids'}) { - my $local_pubkey = $medium->{with_hdlist} =~ /hdlist(.*)\.cz2?$/ ? "pubkey$1" : 'pubkey'; + my $local_pubkey = _guess_pubkey_name($medium); foreach (reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../$local_pubkey"), reduce_pathname("$medium->{url}/pubkey"), ) { -- cgit v1.2.1