This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Install shasum on Windows and VMS too
[perl5.git] / Porting / checkAUTHORS.pl
1 #!/usr/bin/perl -w
2 use strict;
3 use Text::Wrap;
4 $Text::Wrap::columns = 80;
5 my ($committer, $patch, $log);
6 use Getopt::Long;
7
8 my ($rank, @authors, %authors, %untraced, %patchers);
9 my $result = GetOptions ("rank" => \$rank,                      # rank authors
10                          "acknowledged=s"   => \@authors);      # authors files
11
12 if (!$result or !($rank xor @authors) or !@ARGV) {
13   die <<"EOS";
14 $0 --rank Changelogs                        # rank authors by patches
15 $0 --acknowledged <authors file> Changelogs # Display unacknowledged authors
16 Specify stdin as - if needs be. Remember that option names can be abbreviated.
17 EOS
18 }
19
20 my %map = reverse (
21                    # "Correct" => "Alias"
22                    adi => "enache\100rdslink.ro",
23                    alanbur => "alan.burlison\100sun.com",
24                    ams => "ams\100wiw.org",
25                    chip => "chip\100pobox.com",
26                    davem => "davem\100fdgroup.com",
27                    doughera => " doughera\100lafayette.edu",
28                    gbarr => "gbarr\100pobox.com",
29                    gsar => "gsar\100activestate.com",
30                    hv => "hv\100crypt.compulink.co.uk",
31                    jhi => "jhi\100iki.fi",
32                    merijn => "h.m.brand\100xs4all.nl",
33                    mhx => "mhx-perl\100gmx.net",
34                    nicholas => "nick\100unfortu.net",
35                    nick => "nick\100ing-simmons.net",
36                    pudge => "pudge\100pobox.com",
37                    rgs => "rgarciasuarez\100free.fr",
38                    sky => "sky\100nanisky.com", 
39                    steveh => "steve.hay\100uk.radan.com",
40                    stevep => "steve\100fisharerojo.org",
41                    gisle => "gisle\100activestate.com",
42                    "abigail\100abigail.nl"=> "abigail\100foad.org",
43                    "chromatic\100wgz.org" => "chromatic\100rmci.net",
44                    "slaven\100rezic.de" => "slaven.rezic\100berlin.de",
45                    "mjtg\100cam.ac.uk" => "mjtg\100cus.cam.ac.uk",
46                    "robin.barker\100npl.co.uk" => "rmb1\100cise.npl.co.uk",
47                    "paul.marquess\100btinternet.com"
48                    => "paul_marquess\100yahoo.co.uk",
49                    "wolfgang.laun\100chello.at" =>
50                    "wolfgang.laun\100alcatel.at",
51                    "t.jenness\100jach.hawaii.edu" => "timj\100jach.hawaii.edu",
52                    "abe\100ztreet.demon.nl" => "abeltje\100cpan.org",
53                    "nospam-abuse\100bloodgate.com" => "tels\100bloodgate.com",
54                    "jfriedl\100yahoo.com" => "jfriedl\100yahoo-inc.com",
55                    "japhy\100pobox.com" => "japhy\100pobox.org",
56                    "gellyfish\100gellyfish.com" => "jns\100gellyfish.com",
57                    "jcromie\100divsol.com" => "jcromie\100cpan.org",
58                    "demerphq\100gmail.com" => "demerphq\100hotmail.com",
59                    "rick\100consumercontact.com" => "rick\100bort.ca",
60                    "vkonovalov\100spb.lucent.com"
61                    => "vkonovalov\100peterstar.ru",
62                    "rjk\100linguist.dartmouth.edu"
63                    => "rjk\100linguist.thayer.dartmouth.edu",
64                    "domo\100computer.org" => "shouldbedomo\100mac.com",
65                    "kane\100dwim.org" => "kane\100xs4all.net",
66                    "allens\100cpan.org" => "easmith\100beatrice.rutgers.edu",
67                    "spoon\100cpan.org" => "spoon\100dellah.org",
68                    "ben_tilly\100operamail.com" => "btilly\100gmail.com",
69                    "mbarbon\100dsi.unive.it" => "mattia.barbon\100libero.it",
70                    "tassilo.parseval\100post.rwth-aachen.de" =>
71                    "tassilo.von.parseval\100rwth-aachen.de",
72                    "dcd\100tc.fluke.com" => "david.dyck\100fluke.com",
73                    "kroepke\100dolphin-services.de"
74                    => "kay\100dolphin-services.de",
75                    "sebastien\100aperghis.net" => "maddingue\100free.fr",
76                    "radu\100netsoft.ro" => "rgreab\100fx.ro",
77                    "rick\100consumercontact.com"
78                    => "rick.delaney\100rogers.com",
79                    "p5-authors\100crystalflame.net"
80                    => "perl\100crystalflame.net",
81                    "stef\100mongueurs.net" => "stef\100payrard.net",
82                    "kstar\100wolfetech.com" => "kstar\100cpan.org",
83                    "7k8lrvf02\100sneakemail.com" =>
84                    "kjx9zthh3001\100sneakemail.com",
85                    "mgjv\100comdyn.com.au" => "mgjv\100tradingpost.com.au",
86                    "thomas.dorner\100start.de" => "tdorner\100amadeus.net",
87                    "ajohnson\100nvidia.com" => "ajohnson\100wischip.com",
88                    # Maybe we should special case this to get real names out?
89                    "perlbug\100perl.org" => "perlbug-followup\100perl.org",
90                   );
91
92 # Make sure these are all lower case.
93
94 $map{"alan.burlison\100uk.sun.com"} = "alanbur";
95 $map{"artur\100contiller.se"} = $map{"arthur\100contiller.se"} = "sky";
96 $map{"autrijus\100egb.elixus.org"} = $map{"autrijus\100geb.elixus.org"}
97   = "autrijus\100autrijus.org";
98 $map{"craig.berry\100psinetcs.com"} = $map{"craig.berry\100metamorgs.com"}
99   = $map{"craig.berry\100signaltreesolutions.com"}
100   = $map{"craigberry\100mac.com"} = "craigb";
101 $map{"davem\100iabyn.nospamdeletethisbit.com" }
102   = $map{"davem\100fdgroup.co.uk"} = "davem";
103 $map{"ilya\100math.ohio-state.edu"} = $map{"ilya\100math.berkeley.edu"}
104   = $map{"ilya\100math.berkeley.edu"} = "nospam-abuse\100ilyaz.org";
105 $map{"jhietaniemi\100gmail.com"} = $map{"jhi\100kosh.hut.fi"}
106   = $map{"jhi\100cc.hut.fi"} = "jhi";
107 $map{"nick\100ccl4.org"} = $map{"nick\100talking.bollo.cx"}
108   = $map{"nick\100plum.flirble.org"} = $map{"nick\100babyhippo.co.uk"}
109   = $map{"nick\100bagpuss.unfortu.net"} = "nicholas";
110 $map{"philip.newton\100gmx.net"} = $map{"philip.newton\100datenrevision.de"}
111   = $map{"pnewton\100gmx.de"} = "pne\100cpan.org",
112 $map{"rgarciasuarez\100mandrakesoft.com"}
113   = $map{"rgarciasuarez\100mandriva.com"}
114   = $map{"raphel.garcia-suarez\100hexaflux.com"} = "rgs";
115 $map{"simon\100pembro4.pmb.ox.ac.uk"} = $map{"simon\100brecon.co.uk"}
116   = $map{"simon\100othersideofthe.earth.li"} = $map{"simon\100cozens.net"}
117   = $map{"simon\100netthink.co.uk"} = "simon\100simon-cozens.org";
118 $map{"spider\100web.zk3.dec.com"} = $map{"spider\100leggy.zk3.dec.com"}
119   = $map{"spider-perl\100orb.nashua.nh.us"}
120   = $map{"spider\100peano.zk3.dec.com"}
121   = "spider\100orb.nashua.nh.us";
122 $map{"nik\100tiuk.ti.com"} = "nick";
123
124 $map{"a.koenig\100mind.de"} = "andreas.koenig\100anima.de";
125 $map{"japhy\100perlmonk.org"} = $map{"japhy\100cpan.org"}
126   = "japhy\100pobox.com";
127 $map{"rmbarker\100cpan.org"} = "robin.barker\100npl.co.uk";
128
129 $map{"h.m.brand\100hccnet.nl"} = $map{"merijn\100l1.procura.nl"} = "merijn";
130
131 $map{"yves.orton\100de.mci.com"} = $map{"yves.orton\100mciworldcom.de"}
132   = "demerphq\100gmail.com";
133 $map{"jim.cromie\100gmail.com"} = "jcromie\100divsol.com";
134 $map{"perl_dummy\100bloodgate.com"} = "nospam-abuse\100bloodgate.com";
135 $map{"paul.marquess\100ntlworld.com"} = "paul.marquess\100btinternet.com";
136 $map{"konovalo\100mail.wplus.net"} = $map{"vadim\100vkonovalov.ru"}
137   = "vkonovalov\100spb.lucent.com";
138 $map{"kane\100cpan.org"} = "kane\100dwim.org";
139 $map{"rs\100crystalflame.net"} = "p5-authors\100crystalflame.net";
140 $map{"(srezic\100iconmobile.com)"} = "slaven\100rezic.de";
141 $map{"perl\100dellah.anu.edu.au"} = "spoon\100cpan.org";
142
143 $map{"hv\100crypt.org"} = "hv";
144 $map{"gisle\100aas.no"} = "gisle";
145
146 if (@authors) {
147   my %raw;
148   foreach my $filename (@authors) {
149     open FH, "<$filename" or die "Can't open $filename: $!";
150     while (<FH>) {
151       next if /^\#/;
152       next if /^-- /;
153       if (/<([^>]+)>/) {
154         # Easy line.
155         $raw{$1}++;
156       } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
157         # Name only
158         $untraced{$1}++;
159       } else {
160         chomp;
161         warn "Can't parse line '$_'";
162       }
163     }
164   }
165   foreach (keys %raw) {
166     print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
167     $_ = lc $_;
168     $authors{$map{$_} || $_}++;
169   }
170 }
171
172 while (<>) {
173   next if /^-+/;
174   if (m!^\[\s+(\d+)\]\s+By:\s+(\S+)\s+on!) {
175     # new patch
176     my @new = ($1, $2);
177     &process ($committer, $patch, $log);
178     ($patch, $committer) = @new;
179     undef $log;
180   } elsif (s/^(\s+Log: )//) {
181     die "Duplicate Log:" if $log;
182     $log = $_;
183     my $prefix = " " x length $1;
184     LOG: while (<>) {
185       next if /^$/;
186       if (s/^$prefix//) {
187         $log .= $_;
188       } elsif (/^\s+Branch:/) {
189         last LOG;
190       } else {
191         chomp;
192         die "Malformed log end with '$_'";
193       }
194     }
195   }
196 }
197
198 &process ($committer, $patch, $log);
199
200 if ($rank) {
201   &display_ordered;
202 } elsif (%authors) {
203   my %missing;
204   foreach (sort keys %patchers) {
205     next if $authors{$_};
206     # Sort by number of patches, then name.
207     $missing{$patchers{$_}}->{$_}++;
208   }
209   foreach my $patches (sort {$b <=> $a} keys %missing) {
210     print "$patches patch(es)\n";
211     foreach my $author (sort keys %{$missing{$patches}}) {
212       print "  $author\n";
213     }
214   }
215 }
216
217 sub display_ordered {
218   my @sorted;
219   while (my ($name, $count) = each %patchers) {
220     push @{$sorted[$count]}, $name;
221   }
222
223   my $i = @sorted;
224   while (--$i) {
225     next unless $sorted[$i];
226     print wrap ("$i:\t", "\t", join (" ", sort @{$sorted[$i]}), "\n");
227   }
228 }
229
230 sub process {
231   my ($committer, $patch, $log) = @_;
232   return unless $committer;
233   my @authors = $log =~ /From:.+\s+([^\@ \t\n]+\@[^\@ \t\n]+)/gm;
234
235   if (@authors) {
236     foreach (@authors) {
237       s/^<//;
238       s/>$//;
239       $_ = lc $_;
240       $patchers{$map{$_} || $_}++;
241     }
242     # print "$patch: @authors\n";
243   } else {
244     # print "$patch: $committer\n";
245     # Not entirely fair as this means that the maint pumpking scores for
246     # everything intergrated that wasn't a third party patch in blead
247     $patchers{$committer}++;
248   }
249 }
250
251