Import keys one per one - and whine some more when a download fails
authorweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Sat, 8 Jan 2005 23:29:50 +0000 (23:29 +0000)
committerweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Sat, 8 Jan 2005 23:29:50 +0000 (23:29 +0000)
git-svn-id: svn://svn.debian.org/pgp-tools/trunk@30 b513b33f-fedd-0310-b452-c3deb5f4c849

caff/caff

index 4eb9083a4ad564eb45c2196922ec8ef36692dac4..084b41c0bfc419cfe0569f66fc5c7e30fdde5703 100755 (executable)
--- 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;
 };