[Pgp-tools-commit] r816 - in trunk: debian gpglist

Guilhem Moulin guilhem-guest at moszumanska.debian.org
Mon Aug 24 12:49:02 UTC 2015


Author: guilhem-guest
Date: 2015-08-24 12:49:02 +0000 (Mon, 24 Aug 2015)
New Revision: 816

Modified:
   trunk/debian/changelog
   trunk/gpglist/gpglist
Log:
Add an option '--show-revoked' to show revoked UIDs.

Adapted patch from Tomasz Buchert.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2015-08-24 12:48:56 UTC (rev 815)
+++ trunk/debian/changelog	2015-08-24 12:49:02 UTC (rev 816)
@@ -2,6 +2,8 @@
 
   * gpglist:
     + Don't prune revoked UIDs with a subsequent selfsig.  (Closes: #796664)
+    + Add an option '--show-revoked' to show revoked UIDs.  Thanks Tomasz
+      Buchert for the patch.
 
  -- Guilhem Moulin <guilhem at guilhem.org>  Mon, 24 Aug 2015 13:39:59 +0200
 

Modified: trunk/gpglist/gpglist
===================================================================
--- trunk/gpglist/gpglist	2015-08-24 12:48:56 UTC (rev 815)
+++ trunk/gpglist/gpglist	2015-08-24 12:49:02 UTC (rev 816)
@@ -40,13 +40,13 @@
 
 =over
 
-=item B<gpglist> I<keyid>
+=item B<gpglist> [B<--show-revoked>] I<keyid>
 
 =back
 
 =head1 DESCRIPTION
 
-B<gpglist> takes a keyid and creates a listing showing who signed your user IDs.
+B<gpglist> takes a keyid and creates a listing showing who signed I<keyid>'s user IDs.
 
 	$ gpglist 6D8ABE71
 	+-----  1 Christoph Berg <cb at df7cb.de>
@@ -56,6 +56,9 @@
 	x  x  29BE5D2268FD549F Martin Michlmayr <tbm at cyrius.com>
 	   x  7DDB2B8DB4B462C5 Martin Wanke <mawan at mawan.de>
 
+By default only non-revoked identities are listed, but it can be
+overrided it with B<--show-revoked>.
+
 =head1 AUTHORS
 
 =over
@@ -79,13 +82,19 @@
 use strict;
 use warnings;
 use English '-no_match_vars';
+use Getopt::Long;
 
 my $now = time;
-my $key=shift @ARGV;
-unless (defined $key) {
-	die "Usage: $PROGRAM_NAME <keyid>\n";
+my $show_revoked;
+
+sub usage() {
+	die "Usage: $PROGRAM_NAME [--show-revoked] <keyid>\n";
 }
 
+GetOptions("show-revoked" => \$show_revoked) or usage();
+usage unless @ARGV and $#ARGV == 0;
+my $key = shift @ARGV;
+
 open SIGS, '-|', $ENV{GNUPGBIN} // 'gpg', qw/--no-auto-check-trustdb --list-options show-sig-subpackets --fixed-list-mode --with-colons --list-sigs/, $key
 	or die "can't get gpg listing";
 
@@ -134,14 +143,17 @@
 }
 close SIGS;
 
-# XXX: Add an option for this
- at uids = grep { !defined $revs{$longkey}->{$_} or $revs{$longkey}->{$_} < $sigs{$longkey}->{$_} } @uids;
+sub revoked($) {
+    my $k = shift;
+    (!defined $revs{$longkey}->{$k} or $revs{$longkey}->{$k} < $sigs{$longkey}->{$k}) ? 0 : 1
+}
+ at uids = grep { !revoked($_) } @uids unless $show_revoked;
 
 for ( my $a=0; $a <= $#uids; $a++ ) {
 	printf "|  " x $a
 	     . "+--"
 	     . "---" x ($#uids-$a)
-	     . " "
+	     . (revoked($uids[$a]) ? 'R' : ' ')
 	     . "%2i $uids{$uids[$a]}\n", $a+1;
 }
 




More information about the Pgp-tools-commit mailing list