summaryrefslogtreecommitdiffstats
path: root/scripts/parse-gpg-update
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/parse-gpg-update52
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/parse-gpg-update b/scripts/parse-gpg-update
new file mode 100755
index 0000000..844083e
--- /dev/null
+++ b/scripts/parse-gpg-update
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use DB_File;
+
+my %ident;
+
+if ($#ARGV != 0 and $#ARGV != 1) {
+ print "Must supply key id.\n";
+ exit 1;
+}
+
+open KEYIDS, "<keyids" or die "Can't open keyids file: $!";
+while (<KEYIDS>) {
+ chomp;
+ /^0x([^ ]*) (.*)/;
+ $ident{$1} = $2;
+}
+close KEYIDS;
+
+$ARGV[0] =~ s/0x//;
+
+my $keyid = $ARGV[0];
+my $user;
+if (! defined($ident{$ARGV[0]})) {
+ if ($#ARGV == 1) {
+ $user = $ARGV[1] . " [DM]";
+ } else {
+ $user = "UNKNOWN (DM?)";
+ }
+} else {
+ $user = $ident{$ARGV[0]};
+}
+
+my ($uids, $subs, $sigs) = (0, 0, 0);
+while (<STDIN>) {
+ if (/new subkeys: (\d+)$/) {
+ $subs = $1;
+ } elsif (/new user IDs: (\d+)$/) {
+ $uids = $1;
+ } elsif (/new signatures: (\d+)$/) {
+ $sigs = $1;
+ }
+}
+
+print "0x$keyid $user";
+print " uid:$uids" if ($uids > 0);
+print " sub:$subs" if ($subs > 0);
+print " sig:$sigs" if ($sigs > 0);
+print "\n";