aboutsummaryrefslogtreecommitdiffstats
path: root/URPM
diff options
context:
space:
mode:
Diffstat (limited to 'URPM')
-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;