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