File: parse-gpg-update

package info (click to toggle)
debian-keyring 2013.04.21
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 63,116 kB
  • sloc: sh: 510; perl: 256; makefile: 108
file content (48 lines) | stat: -rwxr-xr-x 777 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

use strict;
use warnings;

use DB_File;

my %ident;

if ($#ARGV != 0) {
	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]})) {
	$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";