prepare for upload, add Franck as uploader
[pgp-tools.git] / gpgsigs / gpgsigs
index 49c6e3aff4d0dd14ea223db24344b48c9469360c..e27b33691561e3c40d7b305d87258feb6e11ec6f 100755 (executable)
@@ -20,6 +20,7 @@
 # see the Debian changelog for further changes.
 
 my $VERSION = qq$Rev$;
+$ENV{PATH} .= ":/usr/share/signing-party";
 
 use strict;
 use warnings;
@@ -54,6 +55,8 @@ separate multiple keyids with ','
 -r            call gpg --recv-keys before proceeding
 -f <charset>  convert <keytxt> from charset
 -t <charset>  convert UIDs to charset in output
+--refresh     regenerate UID lists on keys
+--latex       generate LaTeX output including photo IDs
 EOF
        exit $error;
 }
@@ -150,11 +153,12 @@ print STDERR "Running --list-sigs, this will take a while ";
 open SIGS, "gpg --fixed-list-mode --with-colons --list-sigs @mykeys @keys 2>/dev/null |"
        or die "can't get gpg listing";
 
-my ($key, $uid, $sigs);
+my ($key, $uid, $sigs, $photocount);
 while (<SIGS>) {
        if ( m/^pub:(?:.*?:){3,3}([0-9A-F]{16,16}):/ ) {
                $key = $1;
                print STDERR ".";
+               undef $photocount;
                next;
        }
        if ( m/^uid:(.):(?:.*?:){7,7}(.*):/s ) {
@@ -175,8 +179,11 @@ while (<SIGS>) {
                my $size = $3 - 19; # FIXME: find a nicer way to find out picture size
                $uid = "[jpeg image of size $size]";
                next if $uidstatus eq "r";
-               if ($latex) {
-                       system "gpg --photo-viewer 'convert - %k.eps' --list-options show-photos --list-key $key > /dev/null";
+               if ($latex and not $photocount) { # call once per key
+                       my ($shortkey) = substr $key, -8;
+                       system "rm $shortkey.[1-9]*.eps";
+                       system "gpg --photo-viewer 'gpgsigs-eps-helper $shortkey' --list-options show-photos --list-key $key > /dev/null";
+                       $photocount = 1;
                }
                my ($shortkey) = substr $key, -8;
                push @{$uids{$shortkey}}, $uid;
@@ -316,6 +323,7 @@ while (<TXT>) {
                #       next;
                #}
                print WRITE;
+               undef $photocount;
                next;
        }
 
@@ -332,8 +340,9 @@ while (<TXT>) {
                        foreach $uid (@{$uids{$key}}) {
                                print WRITE print_tag($key, $uid) . " $uid\n";
                                if ($latex and ($uid =~ /^\[jpeg image/)) {
+                                       $photocount++;
                                        print WRITE "\\begin{flushright}\n";
-                                       print WRITE "\\includegraphics[height=3cm]{$key.eps}\n";
+                                       print WRITE "\\includegraphics[height=3cm]{$key.$photocount.eps}\n";
                                        print WRITE "\\end{flushright}\n";
                                }
                        }
@@ -388,7 +397,7 @@ B<gpgsigs> - annotate list of GnuPG keys with already done signatures
 
 =head1 SYNOPSIS
 
-B<gpgsigs> [-r] [-f I<charset>] [-t I<charset>] I<keyid>I<[>B<,>I<keyidI<[>B<,>I<...>I<]>>I<]> F<keytxt> [F<outfile>]
+B<gpgsigs> [I<options>] I<keyid>I<[>B<,>I<keyidI<[>B<,>I<...>I<]>>I<]> F<keytxt> [F<outfile>]
 
 =head1 DESCRIPTION
 
@@ -402,19 +411,29 @@ and placeholders (C<__ __>), the checksum is inserted.
 
 =over
 
-=item -r
+=item B<-r>
 
 Call I<gpg --recv-keys> before creating the output.
 
-=item -f I<charset>
+=item B<-f> I<charset>
 
 Convert F<keytxt> from I<charset>. The default is ISO-8859-1.
 
-=item -t I<charset>
+=item B<-t> I<charset>
 
 Convert UIDs to I<charset>. The default is derived from LC_ALL, LC_CTYPE, and
 LANG, and if all these are unset, the default is ISO-8859-1.
 
+=item B<--refresh>
+
+Refresh the UID lists per key from gpg. Useful when UIDs were added or revoked
+since the input text was generated.
+
+=item B<--latex>
+
+Generate LaTeX output, including photo IDs. Implies B<--refresh>.
+B<Note:> This writes eps files to the current directory.
+
 =item I<keyid>
 
 Use this keyid (8 or 16 byte) for annotation. Multiple keyids can be separated