From 5342cb105b215db10fe1c888a63d295208f62377 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 20 Aug 2003 18:53:44 +0000 Subject: added pubkey and rpmdb key importation. --- perl-install/install_any.pm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'perl-install') diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index a79cd828f..e5fd77395 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -495,6 +495,30 @@ sub install_urpmi { #- rare case where urpmi cannot be installed (no hd install path). $method eq 'disk' && !any::hdInstallPath() and return; + #- clean to avoid opening twice the rpm db. + delete $packages->{rpmdb}; + + #- import pubkey in rpmdb. + my $db = pkgs::rpmDbOpenForInstall($prefix); + $packages->parse_pubkeys(db => $db); + foreach (values %$mediums) { + foreach my $k (@{$_->{pubkey}}) { + my $id; + foreach my $kv (values %{$packages->{keys} || {}}) { + URPM::compare_pubkeys($k, $kv) == 0 and $id = $kv->{id}, last; + } + unless ($id) { + URPM::import_pubkey(block => $k->{block}, db => $db); + $packages->parse_pubkeys(db => $db); + foreach my $kv (values %{$packages->{keys} || {}}) { + URPM::compare_pubkeys($k, $kv) == 0 and $id = $kv->{id}, last; + } + } + #- the key has been found, take care of it for the given medium. + $id and $_->{key_ids}{$id} = undef; + } + } + my @cfg; foreach (sort { $a->{medium} <=> $b->{medium} } values %$mediums) { my $name = $_->{fakemedium}; @@ -566,7 +590,8 @@ sub install_urpmi { push @cfg, "$qname " . ($need_list ? "" : $qdir) . " { hdlist: hdlist.$name.cz with_hdlist: $with" . ($need_list ? " - list: list.$name" : "") . ($dir =~ /removable:/ && " + list: list.$name" : "") . (keys(%{$_->{key_ids}}) && " + key-ids: " . join(',', keys(%{$_->{key_ids}}))) . ($dir =~ /removable:/ && " removable: /dev/cdrom") . " update" . " } -- cgit v1.2.1