From 474f4312f92d60973916d1e9be6450da55c4864b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 10 Dec 2007 15:11:30 +0000 Subject: - urpmi.addmedia: o adapt to perl-URPM 2.11 API to parse pubkey files (nb: $urpm->{keys} is not used anymore) --- NEWS | 2 ++ urpm/media.pm | 17 ++++++----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index ba1d71fc..a43d670a 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ o exit code 1 when a medium can't be added o enhance parsing of urls with login:password for logins with "@" so that password doesn't end up in urpmi.cfg + o adapt to perl-URPM 2.11 API to parse pubkey files + (nb: $urpm->{keys} is not used anymore) Version 4.10.17 - 30 November 2007, by Pascal "Pixel" Rigaux diff --git a/urpm/media.pm b/urpm/media.pm index e2cca5e2..5a058803 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -1541,17 +1541,18 @@ sub _read_cachedir_pubkey { $urpm->{log}(N("examining pubkey file of \"%s\"...", $medium->{name})); my $_rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive', wait => $b_wait_lock); + my $db = urpm::db_open_or_die($urpm, $urpm->{root}, 'rw'); my %key_ids; - $urpm->import_needed_pubkeys( - [ $urpm->parse_armored_file("$urpm->{cachedir}/partial/pubkey") ], - root => $urpm->{root}, - callback => sub { - my (undef, undef, $_k, $id, $imported) = @_; + URPM::import_pubkeys($db, + "$urpm->{cachedir}/partial/pubkey", + sub { + my ($id, $imported) = @_; if ($id) { $key_ids{$id} = undef; $imported and $urpm->{log}(N("...imported key %s from pubkey file of \"%s\"", $id, $medium->{name})); + $imported or $urpm->{debug}("pubkey $id already imported") if $urpm->{debug}; } else { $urpm->{error}(N("unable to import pubkey file of \"%s\"", $medium->{name})); } @@ -1786,12 +1787,6 @@ sub update_media { $urpm->{media} or return; # verify that configuration has been read $options{nopubkey} ||= $urpm->{options}{nopubkey}; - if (!$options{nopubkey} && !$urpm->{keys}) { - #- get gpg-pubkey signature. - my $_rpm_lock = urpm::lock::rpm_db($urpm, '', wait => $options{wait_lock}); - $urpm->{log}(qq(getting "gpg-pubkey"s from rpmdb)); - $urpm->parse_pubkeys(root => $urpm->{root}); - } #- examine each medium to see if one of them needs to be updated. #- if this is the case and if not forced, try to use a pre-calculated -- cgit v1.2.1