Follow-up to r29036: Now that the "mergeinfo" transaction file is no
[svn.git] / tools / dist / getsigs.pl
blobfad657d17e33535aea19bf51f880f1db44a10773
1 #!/usr/bin/perl
3 # Terribly ugly hack of a script to verify the signatures on the release
4 # tarballs and produce the list of who signed them in the format we use for
5 # the announcements.
7 # To use just run it in the directory with the signatures and tarballs and
8 # pass the version of subversion you want to check. It assumes gpg is on
9 # you path, if it isn't you should fix that. :D
11 # Script will die if any gpg process returns an error.
13 my $version = $ARGV[0];
14 my %good_sigs;
16 foreach my $filename (glob("subversion-*.asc")) {
17 my $gpg_output = `gpg --logger-fd 1 --verify $filename`;
18 if ($? >> 8 ) {
19 # gpg exited with a non zero exit value, die with an error
20 print $gpg_output;
21 die "BAD SIGNATURE in $filename";
23 foreach my $line (split /\n/, $gpg_output) {
24 # Extract the keyid from the GPG output.
25 my ($keyid) = $line =~ /^gpg: Signature made .*? using \w+ key ID (\w+)/;
26 if (defined($keyid)) {
27 # Put the resulting key in a hash to remove duplicates.
28 $good_sigs{$keyid}++;
33 foreach my $keyid (keys %good_sigs) {
34 my $gpg_output = `gpg --fingerprint $keyid`;
35 if ($? >> 8 ) {
36 # gpg exited with a non zero exit value, die with an error
37 print $gpg_output;
38 die "UNABLE TO GET FINGERPRINT FOR $keyid";
40 my ($long_keyid, $fingerprint, $null, $name) = $gpg_output =~ /^pub\s+(\w+\/\w+)[^\n]*\n\s+Key\sfingerprint\s=((\s+[0-9A-F]{4}){10})\nuid\s+([^<\(]+)\s/;
41 unless (defined($long_keyid) && defined($name) && defined($fingerprint)) {
42 # Hmm some value didn't get filled in, error out.
43 die "Empty value, possible error in gpg output parsing.";
45 print <<"EOL";
46 $name [$long_keyid] with fingerprint:
47 $fingerprint
48 EOL