summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-08-21 13:08:57 +0000
committerFrancois Pons <fpons@mandriva.com>2003-08-21 13:08:57 +0000
commitaf8c348dfa66cee3ca126256bc476b4809bf1f0f (patch)
tree174489ae1c7c3f9d7f5c2ac8ae300d305dfa2b4a /urpm.pm
parent3ded075c5a151551ec9f74e22e44691a695d4320 (diff)
downloadurpmi-af8c348dfa66cee3ca126256bc476b4809bf1f0f.tar
urpmi-af8c348dfa66cee3ca126256bc476b4809bf1f0f.tar.gz
urpmi-af8c348dfa66cee3ca126256bc476b4809bf1f0f.tar.bz2
urpmi-af8c348dfa66cee3ca126256bc476b4809bf1f0f.tar.xz
urpmi-af8c348dfa66cee3ca126256bc476b4809bf1f0f.zip
updated with perl-URPM 0.94 and above (simplified code)
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm37
1 files changed, 11 insertions, 26 deletions
diff --git a/urpm.pm b/urpm.pm
index 5ef6cd14..7f651361 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1806,32 +1806,17 @@ this could happen if you mounted manually the directory when creating the medium
if (-s "$urpm->{cachedir}/partial/pubkey") {
$urpm->{log}(N("examining pubkey file of \"%s\"...", $medium->{name}));
my %key_ids;
- eval {
- foreach my $k ($urpm->parse_armored_file("$urpm->{cachedir}/partial/pubkey")) {
- my $id;
- foreach my $kv (values %{$urpm->{keys} || {}}) {
- URPM::compare_pubkeys($kv, $k) == 0 and $key_ids{$id = $kv->{id}} = undef, last;
- }
- unless ($id) {
- #- the key has not been found, this is important to import it now,
- #- update keys hash (as we do not know how to get key id from its content).
- #- and parse again to found the key.
- $urpm->import_armored_file("$urpm->{cachedir}/partial/pubkey", root => $urpm->{root});
- $urpm->parse_pubkeys(root => $urpm->{root});
-
- foreach my $kv (values %{$urpm->{keys} || {}}) {
- URPM::compare_pubkeys($kv, $k) == 0 and $key_ids{$id = $kv->{id}} = undef, last;
- }
-
- #- now id should be defined, or there is a problem to import the keys...
- if ($id) {
- $urpm->{log}(N("...imported key %s from pubkey file of \"%s\"", $id, $medium->{name}));
- } else {
- $urpm->{error}(N("unable to import pubkey file of \"%s\"", $medium->{name}));
- }
- }
- }
- };
+ $urpm->import_needed_pubkeys([ $urpm->parse_armored_file("$urpm->{cachedir}/partial/pubkey") ],
+ root => $urpm->{root}, callback => sub {
+ my (undef, undef, $k, $id, $imported) = @_;
+ if ($id) {
+ $key_ids{$id} = undef;
+ $imported and $urpm->{log}(N("...imported key %s from pubkey file of \"%s\"",
+ $id, $medium->{name}));
+ } else {
+ $urpm->{error}(N("unable to import pubkey file of \"%s\"", $medium->{name}));
+ }
+ });
keys(%key_ids) and $medium->{'key-ids'} = join ',', keys %key_ids;
}
}