[Pgp-tools-commit] r30 - trunk/caff
Peter Palfrader
weasel at costa.debian.org
Sat Jan 8 23:29:51 UTC 2005
Author: weasel
Date: 2005-01-09 00:29:50 +0100 (Sun, 09 Jan 2005)
New Revision: 30
Modified:
trunk/caff/caff
Log:
Import keys one per one - and whine some more when a download fails
Modified: trunk/caff/caff
===================================================================
--- trunk/caff/caff 2004-12-08 12:08:03 UTC (rev 29)
+++ trunk/caff/caff 2005-01-08 23:29:50 UTC (rev 30)
@@ -518,21 +518,34 @@
$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;
};
More information about the Pgp-tools-commit
mailing list