From 8c0fcf1176d2fee59f3d469c909c4c34401d7e37 Mon Sep 17 00:00:00 2001 From: weasel Date: Sat, 8 Jan 2005 23:29:50 +0000 Subject: [PATCH] Import keys one per one - and whine some more when a download fails git-svn-id: svn://svn.debian.org/pgp-tools/trunk@30 b513b33f-fedd-0310-b452-c3deb5f4c849 --- caff/caff | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/caff/caff b/caff/caff index 4eb9083..084b41c 100755 --- a/caff/caff +++ b/caff/caff @@ -518,21 +518,34 @@ if ($CONFIG{'no-download'}) { $gpg->options->meta_interactive( 0 ); my ($inputfd, $stdoutfd, $stderrfd, $statusfd, $handles) = make_gpg_fds(); - my $pid = $gpg->recv_keys(handles => $handles, command_args => [ @KEYIDS ]); - my ($stdout, $stderr, $status) = readwrite_gpg('', $inputfd, $stdoutfd, $stderrfd, $statusfd); - waitpid $pid, 0; + my @local_keyids = @KEYIDS; + for my $keyid (@local_keyids) { + info ("fetching $keyid..."); + my $pid = $gpg->recv_keys(handles => $handles, command_args => [ $keyid ]); + my ($stdout, $stderr, $status) = readwrite_gpg('', $inputfd, $stdoutfd, $stderrfd, $statusfd); + waitpid $pid, 0; # [GNUPG:] IMPORT_OK 0 5B00C96D5D54AEE1206BAF84DE7AAF6E94C09C7F # [GNUPG:] NODATA 1 # [GNUPG:] NODATA 1 # [GNUPG:] IMPORT_OK 0 25FC1614B8F87B52FF2F99B962AF4031C82E0039 - for my $line (split /\n/, $status) { - if ($line =~ /^\[GNUPG:\] IMPORT_OK/) { - push @keyids_ok, shift @KEYIDS; - } elsif ($line =~ /^\[GNUPG:\] NODATA/) { + my $handled = 0; + for my $line (split /\n/, $status) { + if ($line =~ /^\[GNUPG:\] IMPORT_OK/) { + push @keyids_ok, shift @KEYIDS; + $handled = 1; + last; + } elsif ($line =~ /^\[GNUPG:\] NODATA/) { + push @keyids_failed, shift @KEYIDS; + $handled = 1; + last; + }; + }; + unless ($handled) { + notice ("Huh, what's up with $keyid?"); push @keyids_failed, shift @KEYIDS; }; - } + }; die ("Still keys in \@KEYIDS. This should not happen.") if scalar @KEYIDS; notice ("Import failed for: ". (join ' ', @keyids_failed).".") if scalar @keyids_failed; }; -- 2.39.5