aboutsummaryrefslogtreecommitdiffstats
path: root/URPM/Signature.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-08-06 17:45:09 +0000
committerFrancois Pons <fpons@mandriva.com>2003-08-06 17:45:09 +0000
commitb020aab28e81fd405cc0585c2c0928d2bdd134a0 (patch)
treef7e8b94d4050442a9d1bfb3c64e45d4ab0714f82 /URPM/Signature.pm
parent206d19d511e549403660d9c2dfcf9f471ed669ff (diff)
downloadperl-URPM-b020aab28e81fd405cc0585c2c0928d2bdd134a0.tar
perl-URPM-b020aab28e81fd405cc0585c2c0928d2bdd134a0.tar.gz
perl-URPM-b020aab28e81fd405cc0585c2c0928d2bdd134a0.tar.bz2
perl-URPM-b020aab28e81fd405cc0585c2c0928d2bdd134a0.tar.xz
perl-URPM-b020aab28e81fd405cc0585c2c0928d2bdd134a0.zip
final 0.93-1mdk
Diffstat (limited to 'URPM/Signature.pm')
-rw-r--r--URPM/Signature.pm63
1 files changed, 36 insertions, 27 deletions
diff --git a/URPM/Signature.pm b/URPM/Signature.pm
index 5e90d09..d9c5b2f 100644
--- a/URPM/Signature.pm
+++ b/URPM/Signature.pm
@@ -2,6 +2,37 @@ package URPM;
use strict;
+#- pare from rpmlib db.
+sub parse_pubkeys {
+ my ($urpm, %options) = @_;
+ my ($block, @l, $content);
+
+ my $db = URPM::DB::open($options{root});
+
+ $db->traverse_tag('name', [ 'gpg-pubkey' ], sub {
+ my ($p) = @_;
+ my $s;
+ foreach (split "\n", $p->description) {
+ $block ||= /^-----BEGIN PGP PUBLIC KEY BLOCK-----$/;
+ if ($block) {
+ my $inside_block = /^$/ ... /^-----END PGP PUBLIC KEY BLOCK-----$/;
+ if ($inside_block > 1) {
+ if ($inside_block =~ /E/) {
+ $urpm->{keys}{$p->version} = { $p->summary =~ /^gpg\(\)$/ ? (name => $1) : @{[]},
+ id => $p->version,
+ content => $content,
+ };
+ $block = undef;
+ $content = '';
+ } else {
+ $content .= $_;
+ }
+ }
+ }
+ }
+ })
+}
+
#- parse an armored file and import in keys hash if the key does not already exists.
sub parse_armored_file {
my ($urpm, $file) = @_;
@@ -45,33 +76,11 @@ sub parse_armored_file {
map { +{ content => $_ } } @l;
}
-#- pare from rpmlib db.
-sub parse_pubkeys {
- my ($urpm, $db) = @_;
- my ($block, @l, $content);
+sub import_armored_file {
+ my ($urpm, $file, %options) = @_;
- $db->traverse_tag('name', [ 'gpg-pubkey' ], sub {
- my ($p) = @_;
- my $s;
- foreach (split "\n", $p->description) {
- $block ||= /^-----BEGIN PGP PUBLIC KEY BLOCK-----$/;
- if ($block) {
- my $inside_block = /^$/ ... /^-----END PGP PUBLIC KEY BLOCK-----$/;
- if ($inside_block > 1) {
- if ($inside_block =~ /E/) {
- $urpm->{keys}{$p->version} = { $p->summary =~ /^gpg\(\)$/ ? (name => $1) : @{[]},
- id => $p->version,
- content => $content,
- };
- $block = undef;
- $content = '';
- } else {
- $content .= $_;
- }
- }
- }
- }
- })
+ #- this is a tempory operation currently...
+ system "$ENV{LD_LOADER} rpm ".($options{root} && "--root '$options{root}'" || "")."--import '$file'" == 0 or
+ die "import of armored file failed";
}
-
1;