diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-12-10 14:59:41 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-12-10 14:59:41 +0000 |
commit | 54e360b2cfa968b21527f534dac595a356130a4a (patch) | |
tree | c87b59c8ce8a6f1db0693c30ff75c31952b133f4 /URPM/Signature.pm | |
parent | 32bc8138101e01482000a980e1473cc77e8cff28 (diff) | |
download | perl-URPM-54e360b2cfa968b21527f534dac595a356130a4a.tar perl-URPM-54e360b2cfa968b21527f534dac595a356130a4a.tar.gz perl-URPM-54e360b2cfa968b21527f534dac595a356130a4a.tar.bz2 perl-URPM-54e360b2cfa968b21527f534dac595a356130a4a.tar.xz perl-URPM-54e360b2cfa968b21527f534dac595a356130a4a.zip |
create simpler parse_pubkeys_()
Diffstat (limited to 'URPM/Signature.pm')
-rw-r--r-- | URPM/Signature.pm | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/URPM/Signature.pm b/URPM/Signature.pm index 0e9edd8..66f717b 100644 --- a/URPM/Signature.pm +++ b/URPM/Signature.pm @@ -58,14 +58,25 @@ sub parse_armored_file { @l; } -#- pare from rpmlib db. +#- parse from rpmlib db. +#- +#- side-effects: $urpm sub parse_pubkeys { my ($urpm, %options) = @_; - my ($block, $content); my $db = $options{db}; - $db ||= URPM::DB::open($options{root}) - or die "Can't open RPM DB, aborting\n"; + $db ||= URPM::DB::open($options{root}) or die "Can't open RPM DB, aborting\n"; + my @keys = parse_pubkeys_($db); + + $urpm->{keys}{$_->id} = $_ foreach @keys; +} + +#- side-effects: none +sub parse_pubkeys_ { + my ($db) = @_; + + my ($block, $content); + my %keys; $db->traverse_tag('name', [ 'gpg-pubkey' ], sub { my ($p) = @_; @@ -75,7 +86,7 @@ sub parse_pubkeys { my $inside_block = /^$/ ... /^-----END PGP PUBLIC KEY BLOCK-----$/; if ($inside_block > 1) { if ($inside_block =~ /E/) { - $urpm->{keys}{$p->version} = { + $keys{$p->version} = { $p->summary =~ /^gpg\((.*)\)$/ ? (name => $1) : @{[]}, id => $p->version, content => $content, @@ -90,6 +101,8 @@ sub parse_pubkeys { } } }); + + values %keys; } #- import pubkeys only if it is needed. |