This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlunitut link
[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
8513229b
A
30
31my $prev = "";
32my %map;
33
34while (<DATA>) {
35 chomp;
36 s/\\100/\@/g;
37 $_ = lc;
38 if (my ($correct, $alias) = /^\s*([^#\s]\S*)\s+(.*\S)/) {
39 if ($correct eq '+') {$correct = $prev} else {$prev = $correct}
40 $map {$alias} = $correct;
41 }
42}
43
44#
45# Email addresses for we do not have names.
46#
47$map {$_} = "?" for
4bc69901 48 "agrow\100thegotonerd.com",
8513229b
A
49 "alexander_bluhm\100genua.de",
50 "alexander_gernler\100genua.de",
51 "ammon\100rhythm.com",
52 "bah\100longitude.com",
53 "bbucklan\100jpl-devvax.jpl.nasa.gov",
54 "bilbo\100ua.fm",
55 "bob\100starlabs.net",
56 "bonefish\100cs.tu-berlin.de",
57 "bstrand\100switchmanagement.com",
58 "cygwin\100cygwin.com",
59 "david\100dhaller.de",
60 "dformosa\100dformosa.zeta.org.au",
61 "dgay\100acm.org",
62 "erik\100cs.uni-jena.de",
63 "glasser\100tang-eleven-seventy-nine.mit.edu",
64 "gml4410\100ggr.co.uk",
65 "grommel\100sears.com",
66 "ilya\100juil.nonet",
67 "info\100lingo.kiev.ua",
68 "jms\100mathras.comcast.net",
69 "kan\100dcit.cz",
70 "kaminsky\100math.huji.ac.il",
71 "knew-p5p\100pimb.org",
72 "kvr\100centrum.cz",
73 "mauzo\100csv.warwick.ac.uk",
74 "merijnb\100ms.com",
75 "mlelstv\100serpens.de",
76 "p.boven\100sara.nl",
77 "padre\100elte.hu",
78 "perlbug\100veggiechinese.net",
79 "pm\100capmon.dk",
80 "premchai21\100yahoo.com",
81 "pxm\100nubz.org",
82 "raf\100tradingpost.com.au",
83 "scott\100perlcode.org",
84 "smoketst\100hp46t243.cup.hp.com",
85 "yath-perlbug\100yath.de",
86;
87
88#
89# Email addresses for people that don't have an email address in AUTHORS
90# Presumably deliberately?
91#
92
93$map {$_} = '!' for
cf3e690a
A
94 # Nick Ing-Simmons has passed away (2006-09-25).
95 "nick\100ing-simmons.net",
96 "nik\100tiuk.ti.com",
97 "nick.ing-simmons\100elixent.com",
98
99 # Iain Truskett has passed away (2003-12-29).
8513229b
A
100 "perl\100dellah.anu.edu.au",
101 "spoon\100dellah.org",
102 "spoon\100cpan.org",
103
104 # Ton Hospel
105 "me-02\100ton.iguana.be",
106 "perl-5.8.0\100ton.iguana.be",
107 "perl5-porters\100ton.iguana.be",
108
109 # Beau Cox
110 "beau\100beaucox.com",
111
112 # Randy W. Sims
113 "ml-perl\100thepierianspring.org",
114
115 # Yuval Kogman
116 "nothingmuch\100woobling.org",
117
118;
119
a7ad7795 120
5649b9c9
NC
121if (@authors) {
122 my %raw;
123 foreach my $filename (@authors) {
124 open FH, "<$filename" or die "Can't open $filename: $!";
125 while (<FH>) {
126 next if /^\#/;
127 next if /^-- /;
128 if (/<([^>]+)>/) {
129 # Easy line.
130 $raw{$1}++;
131 } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
132 # Name only
133 $untraced{$1}++;
134 } else {
135 chomp;
136 warn "Can't parse line '$_'";
137 }
138 }
139 }
140 foreach (keys %raw) {
141 print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
142 $_ = lc $_;
143 $authors{$map{$_} || $_}++;
144 }
2b90724c
NC
145 ++$authors{'!'};
146 ++$authors{'?'};
5649b9c9
NC
147}
148
149while (<>) {
150 next if /^-+/;
151 if (m!^\[\s+(\d+)\]\s+By:\s+(\S+)\s+on!) {
152 # new patch
153 my @new = ($1, $2);
154 &process ($committer, $patch, $log);
155 ($patch, $committer) = @new;
156 undef $log;
157 } elsif (s/^(\s+Log: )//) {
158 die "Duplicate Log:" if $log;
159 $log = $_;
160 my $prefix = " " x length $1;
161 LOG: while (<>) {
84fd1186 162 next if /^$/;
bdb5e10e 163 s/^\t/ /;
5649b9c9
NC
164 if (s/^$prefix//) {
165 $log .= $_;
166 } elsif (/^\s+Branch:/) {
167 last LOG;
168 } else {
84fd1186
NC
169 chomp;
170 die "Malformed log end with '$_'";
5649b9c9
NC
171 }
172 }
173 }
174}
175
176&process ($committer, $patch, $log);
177
178if ($rank) {
ff4d71b5
NC
179 &display_ordered(\%patchers);
180} elsif ($ta) {
181 &display_ordered(\%committers);
5649b9c9
NC
182} elsif (%authors) {
183 my %missing;
184 foreach (sort keys %patchers) {
185 next if $authors{$_};
186 # Sort by number of patches, then name.
187 $missing{$patchers{$_}}->{$_}++;
188 }
189 foreach my $patches (sort {$b <=> $a} keys %missing) {
190 print "$patches patch(es)\n";
191 foreach my $author (sort keys %{$missing{$patches}}) {
192 print " $author\n";
193 }
194 }
195}
196
197sub display_ordered {
ff4d71b5 198 my $what = shift;
5649b9c9 199 my @sorted;
15b8f96d 200 my $total;
ff4d71b5 201 while (my ($name, $count) = each %$what) {
5649b9c9 202 push @{$sorted[$count]}, $name;
15b8f96d 203 $total += $count;
5649b9c9
NC
204 }
205
206 my $i = @sorted;
2b0ba25f
NC
207 return unless @sorted;
208 my $sum = 0;
209 foreach my $i ($reverse ? 0 .. $#sorted : reverse 0 .. $#sorted) {
5649b9c9 210 next unless $sorted[$i];
15b8f96d 211 my $prefix;
2b0ba25f
NC
212 $sum += $i * @{$sorted[$i]};
213 # Value to display is either this one, or the cumulative sum.
214 my $value = $cumulative ? $sum : $i;
15b8f96d 215 if ($percentage) {
2b0ba25f 216 $prefix = sprintf "%6.2f:\t", 100 * $value / $total;
15b8f96d 217 } else {
2b0ba25f 218 $prefix = "$value:\t";
15b8f96d
NC
219 }
220 print wrap ($prefix, "\t", join (" ", sort @{$sorted[$i]}), "\n");
5649b9c9
NC
221 }
222}
223
224sub process {
225 my ($committer, $patch, $log) = @_;
226 return unless $committer;
2b90724c 227 my @authors = $log =~ /From:\s+.*?([^"\@ \t\n<>]+\@[^"\@ \t\n<>]+)/gm;
5649b9c9
NC
228
229 if (@authors) {
230 foreach (@authors) {
231 s/^<//;
232 s/>$//;
233 $_ = lc $_;
234 $patchers{$map{$_} || $_}++;
235 }
236 # print "$patch: @authors\n";
ff4d71b5 237 ++$committers{$committer};
5649b9c9
NC
238 } else {
239 # print "$patch: $committer\n";
240 # Not entirely fair as this means that the maint pumpking scores for
241 # everything intergrated that wasn't a third party patch in blead
242 $patchers{$committer}++;
243 }
244}
245
246
8513229b
A
247__DATA__
248
249#
250# List of mappings. First entry the "correct" email address, as appears
251# in the AUTHORS file. Second is any "alias" mapped to it.
252#
253# If the "correct" email address is a '+', the entry above is reused;
254# this for addresses with more than one alias.
255#
256# Note that all entries are in lowercase. Further, no '@' signs should
257# appear; use \100 instead.
258#
259#
260# Committers.
261#
262adi enache\100rdslink.ro
263alanbur alan.burlison\100sun.com
264+ alan.burlison\100uk.sun.com
265ams ams\100wiw.org
266chip chip\100pobox.com
267craigb craig.berry\100psinetcs.com
268+ craig.berry\100metamorgs.com
269+ craig.berry\100signaltreesolutions.com
270+ craigberry\100mac.com
271davem davem\100fdgroup.com
272+ davem\100iabyn.nospamdeletethisbit.com
273+ davem\100fdgroup.co.uk
274+ davem\100fdisolutions.com
275+ davem\100iabyn.com
276demerphq demerphq\100gmail.com
277+ yves.orton\100de.mci.com
278+ yves.orton\100mciworldcom.de
279doughera doughera\100lafayette.edu
280gbarr gbarr\100pobox.com
281gisle gisle\100activestate.com
282+ gisle\100aas.no
283gsar gsar\100activestate.com
284+ gsar\100cpan.org
285hv hv\100crypt.compulink.co.uk
286+ hv\100crypt.org
287jhi jhi\100iki.fi
288+ jhietaniemi\100gmail.com
289+ jhi\100kosh.hut.fi
290+ jhi\100cc.hut.fi
291+ jarkko.hietaniemi\100nokia.com
292merijn h.m.brand\100xs4all.nl
293+ h.m.brand\100hccnet.nl
294+ merijn\100l1.procura.nl
295mhx mhx-perl\100gmx.net
296nicholas nick\100unfortu.net
297+ nick\100ccl4.org
298+ nick\100talking.bollo.cx
299+ nick\100plum.flirble.org
300+ nick\100babyhippo.co.uk
301+ nick\100bagpuss.unfortu.net
8513229b
A
302pudge pudge\100pobox.com
303rgs rgarciasuarez\100free.fr
304+ rgarciasuarez\100mandrakesoft.com
305+ rgarciasuarez\100mandriva.com
306+ rgarciasuarez\100gmail.com
307+ raphel.garcia-suarez\100hexaflux.com
308sky sky\100nanisky.com
309+ artur\100contiller.se
310+ arthur\100contiller.se
b692cd7a
SH
311steveh stevehay\100planit.com
312+ steve.hay\100uk.radan.com
8513229b
A
313stevep steve\100fisharerojo.org
314+ steve.peters\100gmail.com
315
316#
317# Mere mortals.
318#
3197k8lrvf02\100sneakemail.com kjx9zthh3001\100sneakemail.com
320+ dtr8sin02\100sneakemail.com
321+ rt8363b02\100sneakemail.com
322+ o6hhmk002\100sneakemail.com
323
324abe\100ztreet.demon.nl abeltje\100cpan.org
325abigail\100abigail.be abigail\100foad.org
326+ abigail\100abigail.nl
327ajohnson\100nvidia.com ajohnson\100wischip.com
328alexm\100netli.com alexm\100w-m.ru
329alian\100cpan.org alian\100alianwebserver.com
330allens\100cpan.org easmith\100beatrice.rutgers.edu
331andreas.koenig\100anima.de andreas.koenig.gmwojprw\100franz.ak.mind.de
332+ andreas.koenig.7os6vvqr\100franz.ak.mind.de
333+ a.koenig\100mind.de
334anno4000\100lublin.zrz.tu-berlin.de anno4000\100mailbox.tu-berlin.de
335+ siegel\100zrz.tu-berlin.de
336ash\100cpan.org ash_cpan\100firemirror.com
337avarab\100gmail.com avar\100cpan.org
338
339bah\100ecnvantage.com bholzman\100longitude.com
851d3318 340bcarter@gumdrop.flyinganvil.org q.eibcartereio.=~m-b.{6}-cgimosx@gumdrop.flyinganvil.org
8513229b
A
341ben_tilly\100operamail.com btilly\100gmail.com
342
343chromatic\100wgz.org chromatic\100rmci.net
344clkao\100clkao.org clkao\100bestpractical.com
345cp\100onsitetech.com publiustemp-p5p\100yahoo.com
346+ publiustemp-p5p3\100yahoo.com
347cpan\100audreyt.org autrijus\100egb.elixus.org
348+ autrijus\100geb.elixus.org
349+ autrijus\100gmail.com
350+ autrijus\100ossf.iis.sinica.edu.tw
351+ autrijus\100autrijus.org
352+ audreyt\100audreyt.org
353
354damian\100cs.monash.edu.au damian\100conway.org
355david.dyck\100fluke.com dcd\100tc.fluke.com
356demerphq\100gmail.com demerphq\100hotmail.com
357domo\100computer.org shouldbedomo\100mac.com
358
359epeschko\100den-mdev1 esp5\100pge.com
360
361fugazi\100zyx.net larrysh\100cpan.org
362
363gellyfish\100gellyfish.com jns\100gellyfish.com
364gp\100familiehaase.de gerrit\100familiehaase.de
365grazz\100pobox.com grazz\100nyc.rr.com
366
367hio\100ymir.co.jp hio\100hio.jp
368
369japhy\100pobox.com japhy\100pobox.org
370+ japhy\100perlmonk.org
371+ japhy\100cpan.org
372jari.aalto\100poboxes.com jari.aalto\100cante.net
373jcromie\100divsol.com jcromie\100cpan.org
374+ jim.cromie\100gmail.com
375jdhedden\100cpan.org jerry\100hedden.us
376+ jdhedden\1001979.usna.com
377+ jdhedden\100gmail.com
378+ jdhedden\100yahoo.com
379jfriedl\100yahoo.com jfriedl\100yahoo-inc.com
380jjore\100cpan.org twists\100gmail.com
381juerd\100cpan.org juerd\100convolution.nl
382
383kane\100dwim.org kane\100xs4all.net
384+ kane\100cpan.org
385+ kane\100xs4all.nl
386+ jos\100dwim.org
387+ jib\100ripe.net
388kroepke\100dolphin-services.de kay\100dolphin-services.de
389kstar\100wolfetech.com kstar\100cpan.org
390
391mats\100sm6sxl.net mats\100sm5sxl.net
392mbarbon\100dsi.unive.it mattia.barbon\100libero.it
393mcmahon\100ibiblio.org mcmahon\100metalab.unc.edu
394merijnb\100iloquent.nl merijnb\100iloquent.com
395mgjv\100comdyn.com.au mgjv\100tradingpost.com.au
396michael.schroeder\100informatik.uni-erlangen.de mls\100suse.de
397mike\100stok.co.uk mike\100exegenix.com
398mjtg\100cam.ac.uk mjtg\100cus.cam.ac.uk
399
400nospam-abuse\100bloodgate.com tels\100bloodgate.com
401+ perl_dummy\100bloodgate.com
402nospam-abuse\100ilyaz.org ilya\100math.ohio-state.edu
403+ ilya\100math.berkeley.edu
404+ ilya\100math.berkeley.edu
405
406p5-authors\100crystalflame.net perl\100crystalflame.net
407+ rs\100crystalflame.net
408paul.green\100stratus.com paul_greenvos\100vos.stratus.com
409paul.marquess\100btinternet.com paul_marquess\100yahoo.co.uk
410+ paul.marquess\100ntlworld.com
411+ paul.marquess\100openwave.com
412pcg\100goof.com schmorp\100schmorp.de
413# Maybe we should special case this to get real names out?
414perlbug\100perl.org perlbug-followup\100perl.org
415+ bugs-perl5\100bugs6.perl.org
416phil\100perkpartners.com phil\100finchcomputer.com
417pimlott\100idiomtech.com andrew\100pimlott.net
418pne\100cpan.org philip.newton\100gmx.net
419+ philip.newton\100datenrevision.de
420+ pnewton\100gmx.de
421
422radu\100netsoft.ro rgreab\100fx.ro
423richard.foley\100ubsw.com richard.foley\100t-online.de
424+ richard.foley\100ubs.com
425+ richard.foley\100rfi.net
426rick\100consumercontact.com rick\100bort.ca
427+ rick.delaney\100rogers.com
4bc69901 428rjbs\100cpan.org rjbs-perl-p5p\100lists.manxome.org
8513229b
A
429rjk\100linguist.dartmouth.edu rjk\100linguist.thayer.dartmouth.edu
430+ rjk-perl-p5p\100tamias.net
431rmgiroux\100acm.org rmgiroux\100hotmail.com
432robin.barker\100npl.co.uk rmb1\100cise.npl.co.uk
433+ rmbarker\100cpan.org
434rootbeer\100teleport.com rootbeer\100redcat.com
435
436schubiger\100cpan.org steven\100accognoscere.org
437+ sts\100accognoscere.org
438schwern\100pobox.com schwern\100gmail.com
8ed05479
MS
439+ schwern\100athens.arena-i.com
440+ schwern\100blackrider.aocn.com
441+ schwern\100ool-18b93024.dyn.optonline.net
8513229b
A
442sebastien\100aperghis.net maddingue\100free.fr
443+ saper\100cpan.org
444simon\100simon-cozens.org simon\100pembro4.pmb.ox.ac.uk
445+ simon\100brecon.co.uk
446+ simon\100othersideofthe.earth.li
447+ simon\100cozens.net
448+ simon\100netthink.co.uk
449slaven\100rezic.de slaven.rezic\100berlin.de
450+ (srezic\100iconmobile.com)
451smcc\100mit.edu smcc\100ocf.berkeley.edu
452+ smcc\100csua.berkeley.edu
453spider\100orb.nashua.nh.us spider\100web.zk3.dec.com
454+ spider\100leggy.zk3.dec.com
455+ spider-perl\100orb.nashua.nh.us
456+ spider\100peano.zk3.dec.com
457stef\100mongueurs.net stef\100payrard.net
458+ s.payrard\100wanadoo.fr
459
460tassilo.parseval\100post.rwth-aachen.de tassilo.von.parseval\100rwth-aachen.de
461thomas.dorner\100start.de tdorner\100amadeus.net
462tjenness\100cpan.org t.jenness\100jach.hawaii.edu
463+ timj\100jach.hawaii.edu
464tom.horsley\100mail.ccur.com tom.horsley\100ccur.com
465
466vkonovalov\100lucent.com vkonovalov\100peterstar.ru
467+ konovalo\100mail.wplus.net
468+ vadim\100vkonovalov.ru
469+ vkonovalov\100spb.lucent.com
470+ vkonovalov\100alcatel-lucent.com
471
472whatever\100davidnicol.com davidnicol\100gmail.com
473wolfgang.laun\100alcatel.at wolfgang.laun\100chello.at
474+ wolfgang.laun\100thalesgroup.com
475+ wolfgang.laun\100gmail.com