This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add test preambles
[perl5.git] / Porting / checkAUTHORS.pl
CommitLineData
5649b9c9
NC
1#!/usr/bin/perl -w
2use strict;
3use Text::Wrap;
4$Text::Wrap::columns = 80;
5my ($committer, $patch, $log);
6use Getopt::Long;
7
2b0ba25f
NC
8my ($rank, $percentage, $cumulative, $reverse, $ta, @authors, %authors,
9 %untraced, %patchers, %committers);
ff4d71b5
NC
10my $result = GetOptions ("rank" => \$rank, # rank authors
11 "thanks-applied" => \$ta, # ranks committers
15b8f96d
NC
12 "acknowledged=s" => \@authors , # authors files
13 "percentage" => \$percentage, # show as %age
2b0ba25f
NC
14 "cumulative" => \$cumulative,
15 "reverse" => \$reverse,
15b8f96d 16 );
5649b9c9 17
ff4d71b5 18if (!$result or (($rank||0) + ($ta||0) + (@authors ? 1 : 0) != 1) or !@ARGV) {
5649b9c9
NC
19 die <<"EOS";
20$0 --rank Changelogs # rank authors by patches
21$0 --acknowledged <authors file> Changelogs # Display unacknowledged authors
ff4d71b5 22$0 --thanks-applied Changelogs # ranks committers
15b8f96d 23$0 --percentage ... # show rankings as percentages
2b0ba25f
NC
24$0 --cumulative ... # show rankings cumulatively
25$0 --reverse ... # show rankings in reverse
5649b9c9
NC
26Specify stdin as - if needs be. Remember that option names can be abbreviated.
27EOS
28}
29
30my %map = reverse (
31 # "Correct" => "Alias"
32 adi => "enache\100rdslink.ro",
33 alanbur => "alan.burlison\100sun.com",
34 ams => "ams\100wiw.org",
35 chip => "chip\100pobox.com",
36 davem => "davem\100fdgroup.com",
37 doughera => " doughera\100lafayette.edu",
38 gbarr => "gbarr\100pobox.com",
39 gsar => "gsar\100activestate.com",
40 hv => "hv\100crypt.compulink.co.uk",
41 jhi => "jhi\100iki.fi",
3bd76f0a 42 merijn => "h.m.brand\100xs4all.nl",
5649b9c9
NC
43 mhx => "mhx-perl\100gmx.net",
44 nicholas => "nick\100unfortu.net",
45 nick => "nick\100ing-simmons.net",
46 pudge => "pudge\100pobox.com",
47 rgs => "rgarciasuarez\100free.fr",
48 sky => "sky\100nanisky.com",
5e266217
NC
49 steveh => "steve.hay\100uk.radan.com",
50 stevep => "steve\100fisharerojo.org",
a7ad7795 51 gisle => "gisle\100activestate.com",
5649b9c9
NC
52 "abigail\100abigail.nl"=> "abigail\100foad.org",
53 "chromatic\100wgz.org" => "chromatic\100rmci.net",
54 "slaven\100rezic.de" => "slaven.rezic\100berlin.de",
55 "mjtg\100cam.ac.uk" => "mjtg\100cus.cam.ac.uk",
56 "robin.barker\100npl.co.uk" => "rmb1\100cise.npl.co.uk",
57 "paul.marquess\100btinternet.com"
58 => "paul_marquess\100yahoo.co.uk",
59 "wolfgang.laun\100chello.at" =>
60 "wolfgang.laun\100alcatel.at",
61 "t.jenness\100jach.hawaii.edu" => "timj\100jach.hawaii.edu",
62 "abe\100ztreet.demon.nl" => "abeltje\100cpan.org",
a7ad7795 63 "nospam-abuse\100bloodgate.com" => "tels\100bloodgate.com",
5649b9c9
NC
64 "jfriedl\100yahoo.com" => "jfriedl\100yahoo-inc.com",
65 "japhy\100pobox.com" => "japhy\100pobox.org",
66 "gellyfish\100gellyfish.com" => "jns\100gellyfish.com",
a7ad7795
NC
67 "jcromie\100divsol.com" => "jcromie\100cpan.org",
68 "demerphq\100gmail.com" => "demerphq\100hotmail.com",
69 "rick\100consumercontact.com" => "rick\100bort.ca",
70 "vkonovalov\100spb.lucent.com"
71 => "vkonovalov\100peterstar.ru",
72 "rjk\100linguist.dartmouth.edu"
73 => "rjk\100linguist.thayer.dartmouth.edu",
74 "domo\100computer.org" => "shouldbedomo\100mac.com",
75 "kane\100dwim.org" => "kane\100xs4all.net",
76 "allens\100cpan.org" => "easmith\100beatrice.rutgers.edu",
77 "spoon\100cpan.org" => "spoon\100dellah.org",
657b1971
NC
78 "ben_tilly\100operamail.com" => "btilly\100gmail.com",
79 "mbarbon\100dsi.unive.it" => "mattia.barbon\100libero.it",
80 "tassilo.parseval\100post.rwth-aachen.de" =>
81 "tassilo.von.parseval\100rwth-aachen.de",
82 "dcd\100tc.fluke.com" => "david.dyck\100fluke.com",
83 "kroepke\100dolphin-services.de"
84 => "kay\100dolphin-services.de",
85 "sebastien\100aperghis.net" => "maddingue\100free.fr",
86 "radu\100netsoft.ro" => "rgreab\100fx.ro",
87 "rick\100consumercontact.com"
88 => "rick.delaney\100rogers.com",
89 "p5-authors\100crystalflame.net"
90 => "perl\100crystalflame.net",
91 "stef\100mongueurs.net" => "stef\100payrard.net",
18f651c1
NC
92 "kstar\100wolfetech.com" => "kstar\100cpan.org",
93 "7k8lrvf02\100sneakemail.com" =>
94 "kjx9zthh3001\100sneakemail.com",
95 "mgjv\100comdyn.com.au" => "mgjv\100tradingpost.com.au",
96 "thomas.dorner\100start.de" => "tdorner\100amadeus.net",
97 "ajohnson\100nvidia.com" => "ajohnson\100wischip.com",
5f9c001d 98 "phil\100perkpartners.com" => "phil\100finchcomputer.com",
39243be7
NC
99 "tom.horsley\100mail.ccur.com" => "tom.horsley\100ccur.com",
100 "rootbeer\100teleport.com" => "rootbeer\100redcat.com",
101 "cp\100onsitetech.com" => "publiustemp-p5p\100yahoo.com",
102 "epeschko\100den-mdev1" => "esp5\100pge.com",
103 "pimlott\100idiomtech.com" => "andrew\100pimlott.net",
104 "fugazi\100zyx.net" => "larrysh\100cpan.org",
105 "merijnb\100iloquent.nl" => "merijnb\100iloquent.com",
106 "whatever\100davidnicol.com" => "davidnicol\100gmail.com",
107 "rmgiroux\100acm.org" => "rmgiroux\100hotmail.com",
108 "smcc\100mit.edu" => "smcc\100ocf.berkeley.edu",
0ad39044 109 "schubiger\100cpan.org" => "steven\100accognoscere.org",
2b90724c
NC
110 "richard.foley\100ubsw.com"
111 => "richard.foley\100t-online.de",
112 "damian\100cs.monash.edu.au" => "damian\100conway.org",
113 "gp\100familiehaase.de" => "gerrit\100familiehaase.de",
114 "juerd\100cpan.org" => "juerd\100convolution.nl",
115 "paul.green\100stratus.com"
116 => "paul_greenvos\100vos.stratus.com",
117 "alian\100cpan.org" => "alian\100alianwebserver.com",
bf607fdc 118 "david.dyck\100fluke.com" => "dcd\100tc.fluke.com",
a7ad7795
NC
119 # Maybe we should special case this to get real names out?
120 "perlbug\100perl.org" => "perlbug-followup\100perl.org",
5649b9c9
NC
121 );
122
123# Make sure these are all lower case.
124
5649b9c9 125$map{"autrijus\100egb.elixus.org"} = $map{"autrijus\100geb.elixus.org"}
2b90724c 126 = $map{"autrijus\100gmail.com"} = $map{"autrijus\100ossf.iis.sinica.edu.tw"}
4d8e9145 127 = $map{"autrijus\100autrijus.org"} = "cpan\100audreyt.org";
5649b9c9
NC
128$map{"ilya\100math.ohio-state.edu"} = $map{"ilya\100math.berkeley.edu"}
129 = $map{"ilya\100math.berkeley.edu"} = "nospam-abuse\100ilyaz.org";
5649b9c9 130$map{"philip.newton\100gmx.net"} = $map{"philip.newton\100datenrevision.de"}
a7ad7795 131 = $map{"pnewton\100gmx.de"} = "pne\100cpan.org",
5649b9c9
NC
132$map{"simon\100pembro4.pmb.ox.ac.uk"} = $map{"simon\100brecon.co.uk"}
133 = $map{"simon\100othersideofthe.earth.li"} = $map{"simon\100cozens.net"}
134 = $map{"simon\100netthink.co.uk"} = "simon\100simon-cozens.org";
135$map{"spider\100web.zk3.dec.com"} = $map{"spider\100leggy.zk3.dec.com"}
136 = $map{"spider-perl\100orb.nashua.nh.us"}
137 = $map{"spider\100peano.zk3.dec.com"}
138 = "spider\100orb.nashua.nh.us";
2b90724c
NC
139$map{"andreas.koenig.gmwojprw\100franz.ak.mind.de"}
140 = $map{"a.koenig\100mind.de"} = "andreas.koenig\100anima.de";
5649b9c9
NC
141$map{"japhy\100perlmonk.org"} = $map{"japhy\100cpan.org"}
142 = "japhy\100pobox.com";
143$map{"rmbarker\100cpan.org"} = "robin.barker\100npl.co.uk";
a7ad7795 144$map{"yves.orton\100de.mci.com"} = $map{"yves.orton\100mciworldcom.de"}
657b1971 145 = "demerphq\100gmail.com";
a7ad7795
NC
146$map{"jim.cromie\100gmail.com"} = "jcromie\100divsol.com";
147$map{"perl_dummy\100bloodgate.com"} = "nospam-abuse\100bloodgate.com";
148$map{"paul.marquess\100ntlworld.com"} = "paul.marquess\100btinternet.com";
657b1971
NC
149$map{"konovalo\100mail.wplus.net"} = $map{"vadim\100vkonovalov.ru"}
150 = "vkonovalov\100spb.lucent.com";
151$map{"kane\100cpan.org"} = "kane\100dwim.org";
152$map{"rs\100crystalflame.net"} = "p5-authors\100crystalflame.net";
18f651c1
NC
153$map{"(srezic\100iconmobile.com)"} = "slaven\100rezic.de";
154$map{"perl\100dellah.anu.edu.au"} = "spoon\100cpan.org";
39243be7 155$map{"rjk-perl-p5p\100tamias.net"} = "rjk\100linguist.dartmouth.edu";
0ad39044 156$map{"sts\100accognoscere.org"} = "schubiger\100cpan.org";
6fbb3cd3 157$map{"s.payrard\100wanadoo.fr"} = "stef\100mongueurs.net";
2b90724c 158$map{"richard.foley\100ubs.com"} = "richard.foley\100ubsw.com";
c0707526
JH
159$map{"jerry\100hedden.us"} = $map{"jdhedden\100" . "1979.usna.com"} =
160$map{"jdhedden\100gmail.com"} = $map{"jdhedden\100yahoo.com"}
161 = "jdhedden\100cpan.org";
7154214c 162# I assume that Ton Hospel's lack of e-mail address in AUTHORS is deliberate
2b90724c
NC
163$map{"me-02\100ton.iguana.be"} = $map{"perl-5.8.0\100ton.iguana.be"}
164 = $map{"perl5-porters\100ton.iguana.be"} = "!";
165# No real name for these address
166$map{$_} = "?" foreach ("grommel\100sears.com", "pxm\100nubz.org",
5e71429c 167 "padre\100elte.hu",
2b90724c
NC
168 "nothingmuch\100woobling.org", "bob\100starlabs.net",
169 "bbucklan\100jpl-devvax.jpl.nasa.gov",
170 "bilbo\100ua.fm", "mats\100sm5sxl.net",
171 "chris\100ex-parrot.com",
172 "kaminsky\100math.huji.ac.il",
173 "bonefish\100cs.tu-berlin.de",
174 "bstrand\100switchmanagement.com",
175 "glasser\100tang-eleven-seventy-nine.mit.edu",
176 "raf\100tradingpost.com.au", "erik\100cs.uni-jena.de",
177 "jms\100mathras.comcast.net", "kvr\100centrum.cz",
178 "perlbug\100veggiechinese.net",
179 "scott\100perlcode.org",
180 );
181# We don't have an e-mail address for Beau Cox
182$map{"beau\100beaucox.com"} = "?";
6fbb3cd3
NC
183
184$map{"rgarciasuarez\100mandrakesoft.com"}
185 = $map{"rgarciasuarez\100mandriva.com"}
f5adfaf5 186 = $map{"rgarciasuarez\100gmail.com"}
6fbb3cd3
NC
187 = $map{"raphel.garcia-suarez\100hexaflux.com"} = "rgs";
188$map{"jhietaniemi\100gmail.com"} = $map{"jhi\100kosh.hut.fi"}
2b90724c 189 = $map{"jhi\100cc.hut.fi"} = $map{"jarkko.hietaniemi\100nokia.com"} = "jhi";
6fbb3cd3
NC
190$map{"nick\100ccl4.org"} = $map{"nick\100talking.bollo.cx"}
191 = $map{"nick\100plum.flirble.org"} = $map{"nick\100babyhippo.co.uk"}
192 = $map{"nick\100bagpuss.unfortu.net"} = "nicholas";
193$map{"craig.berry\100psinetcs.com"} = $map{"craig.berry\100metamorgs.com"}
194 = $map{"craig.berry\100signaltreesolutions.com"}
195 = $map{"craigberry\100mac.com"} = "craigb";
196$map{"davem\100iabyn.nospamdeletethisbit.com" }
2b90724c
NC
197 = $map{"davem\100fdgroup.co.uk"} = $map{"davem\100fdisolutions.com"}
198 = "davem";
6fbb3cd3
NC
199$map{"alan.burlison\100uk.sun.com"} = "alanbur";
200$map{"artur\100contiller.se"} = $map{"arthur\100contiller.se"} = "sky";
201$map{"h.m.brand\100hccnet.nl"} = $map{"merijn\100l1.procura.nl"} = "merijn";
2b90724c 202$map{"nik\100tiuk.ti.com"} = $map{"nick.ing-simmons\100elixent.com"} = "nick";
a7ad7795
NC
203$map{"hv\100crypt.org"} = "hv";
204$map{"gisle\100aas.no"} = "gisle";
9d5e8f04 205$map{"gsar\100cpan.org"} = "gsar";
a7ad7795 206
5649b9c9
NC
207if (@authors) {
208 my %raw;
209 foreach my $filename (@authors) {
210 open FH, "<$filename" or die "Can't open $filename: $!";
211 while (<FH>) {
212 next if /^\#/;
213 next if /^-- /;
214 if (/<([^>]+)>/) {
215 # Easy line.
216 $raw{$1}++;
217 } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
218 # Name only
219 $untraced{$1}++;
220 } else {
221 chomp;
222 warn "Can't parse line '$_'";
223 }
224 }
225 }
226 foreach (keys %raw) {
227 print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
228 $_ = lc $_;
229 $authors{$map{$_} || $_}++;
230 }
2b90724c
NC
231 ++$authors{'!'};
232 ++$authors{'?'};
5649b9c9
NC
233}
234
235while (<>) {
236 next if /^-+/;
237 if (m!^\[\s+(\d+)\]\s+By:\s+(\S+)\s+on!) {
238 # new patch
239 my @new = ($1, $2);
240 &process ($committer, $patch, $log);
241 ($patch, $committer) = @new;
242 undef $log;
243 } elsif (s/^(\s+Log: )//) {
244 die "Duplicate Log:" if $log;
245 $log = $_;
246 my $prefix = " " x length $1;
247 LOG: while (<>) {
84fd1186 248 next if /^$/;
bdb5e10e 249 s/^\t/ /;
5649b9c9
NC
250 if (s/^$prefix//) {
251 $log .= $_;
252 } elsif (/^\s+Branch:/) {
253 last LOG;
254 } else {
84fd1186
NC
255 chomp;
256 die "Malformed log end with '$_'";
5649b9c9
NC
257 }
258 }
259 }
260}
261
262&process ($committer, $patch, $log);
263
264if ($rank) {
ff4d71b5
NC
265 &display_ordered(\%patchers);
266} elsif ($ta) {
267 &display_ordered(\%committers);
5649b9c9
NC
268} elsif (%authors) {
269 my %missing;
270 foreach (sort keys %patchers) {
271 next if $authors{$_};
272 # Sort by number of patches, then name.
273 $missing{$patchers{$_}}->{$_}++;
274 }
275 foreach my $patches (sort {$b <=> $a} keys %missing) {
276 print "$patches patch(es)\n";
277 foreach my $author (sort keys %{$missing{$patches}}) {
278 print " $author\n";
279 }
280 }
281}
282
283sub display_ordered {
ff4d71b5 284 my $what = shift;
5649b9c9 285 my @sorted;
15b8f96d 286 my $total;
ff4d71b5 287 while (my ($name, $count) = each %$what) {
5649b9c9 288 push @{$sorted[$count]}, $name;
15b8f96d 289 $total += $count;
5649b9c9
NC
290 }
291
292 my $i = @sorted;
2b0ba25f
NC
293 return unless @sorted;
294 my $sum = 0;
295 foreach my $i ($reverse ? 0 .. $#sorted : reverse 0 .. $#sorted) {
5649b9c9 296 next unless $sorted[$i];
15b8f96d 297 my $prefix;
2b0ba25f
NC
298 $sum += $i * @{$sorted[$i]};
299 # Value to display is either this one, or the cumulative sum.
300 my $value = $cumulative ? $sum : $i;
15b8f96d 301 if ($percentage) {
2b0ba25f 302 $prefix = sprintf "%6.2f:\t", 100 * $value / $total;
15b8f96d 303 } else {
2b0ba25f 304 $prefix = "$value:\t";
15b8f96d
NC
305 }
306 print wrap ($prefix, "\t", join (" ", sort @{$sorted[$i]}), "\n");
5649b9c9
NC
307 }
308}
309
310sub process {
311 my ($committer, $patch, $log) = @_;
312 return unless $committer;
2b90724c 313 my @authors = $log =~ /From:\s+.*?([^"\@ \t\n<>]+\@[^"\@ \t\n<>]+)/gm;
5649b9c9
NC
314
315 if (@authors) {
316 foreach (@authors) {
317 s/^<//;
318 s/>$//;
319 $_ = lc $_;
320 $patchers{$map{$_} || $_}++;
321 }
322 # print "$patch: @authors\n";
ff4d71b5 323 ++$committers{$committer};
5649b9c9
NC
324 } else {
325 # print "$patch: $committer\n";
326 # Not entirely fair as this means that the maint pumpking scores for
327 # everything intergrated that wasn't a third party patch in blead
328 $patchers{$committer}++;
329 }
330}
331
332