This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] perlreguts.pod: use the unicode name for ß and show the codepoint
[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, $percentage, $cumulative, $reverse, $ta, @authors, %authors,
9     %untraced, %patchers, %committers);
10 my $result = GetOptions ("rank" => \$rank,                  # rank authors
11                          "thanks-applied" => \$ta,          # ranks committers
12                          "acknowledged=s"   => \@authors ,  # authors files
13                          "percentage" => \$percentage,      # show as %age
14                          "cumulative" => \$cumulative,
15                          "reverse" => \$reverse,
16                         );
17
18 if (!$result or (($rank||0) + ($ta||0) + (@authors ? 1 : 0) != 1) or !@ARGV) {
19   die <<"EOS";
20 $0 --rank Changelogs                        # rank authors by patches
21 $0 --acknowledged <authors file> Changelogs # Display unacknowledged authors
22 $0 --thanks-applied Changelogs              # ranks committers
23 $0 --percentage ...                         # show rankings as percentages
24 $0 --cumulative ...                         # show rankings cumulatively
25 $0 --reverse ...                            # show rankings in reverse
26 Specify stdin as - if needs be. Remember that option names can be abbreviated.
27 EOS
28 }
29
30 my %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",
42                    merijn => "h.m.brand\100xs4all.nl",
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", 
49                    steveh => "steve.hay\100uk.radan.com",
50                    stevep => "steve\100fisharerojo.org",
51                    gisle => "gisle\100activestate.com",
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",
63                    "nospam-abuse\100bloodgate.com" => "tels\100bloodgate.com",
64                    "jfriedl\100yahoo.com" => "jfriedl\100yahoo-inc.com",
65                    "japhy\100pobox.com" => "japhy\100pobox.org",
66                    "gellyfish\100gellyfish.com" => "jns\100gellyfish.com",
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",
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",
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",
98                    "phil\100perkpartners.com" => "phil\100finchcomputer.com",
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",
109                    "schubiger\100cpan.org" => "steven\100accognoscere.org",
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",
118                    "david.dyck\100fluke.com" => "dcd\100tc.fluke.com",
119                    # Maybe we should special case this to get real names out?
120                    "perlbug\100perl.org" => "perlbug-followup\100perl.org",
121                   );
122
123 # Make sure these are all lower case.
124
125 $map{"autrijus\100egb.elixus.org"} = $map{"autrijus\100geb.elixus.org"}
126   = $map{"autrijus\100gmail.com"} = $map{"autrijus\100ossf.iis.sinica.edu.tw"}
127   = $map{"autrijus\100autrijus.org"} = "cpan\100audreyt.org";
128 $map{"ilya\100math.ohio-state.edu"} = $map{"ilya\100math.berkeley.edu"}
129   = $map{"ilya\100math.berkeley.edu"} = "nospam-abuse\100ilyaz.org";
130 $map{"philip.newton\100gmx.net"} = $map{"philip.newton\100datenrevision.de"}
131   = $map{"pnewton\100gmx.de"} = "pne\100cpan.org",
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";
139 $map{"andreas.koenig.gmwojprw\100franz.ak.mind.de"}
140   = $map{"a.koenig\100mind.de"} =  "andreas.koenig\100anima.de";
141 $map{"japhy\100perlmonk.org"} = $map{"japhy\100cpan.org"}
142   = "japhy\100pobox.com";
143 $map{"rmbarker\100cpan.org"} = "robin.barker\100npl.co.uk";
144 $map{"yves.orton\100de.mci.com"} = $map{"yves.orton\100mciworldcom.de"}
145   = "demerphq\100gmail.com";
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";
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";
153 $map{"(srezic\100iconmobile.com)"} = "slaven\100rezic.de";
154 $map{"perl\100dellah.anu.edu.au"} = "spoon\100cpan.org";
155 $map{"rjk-perl-p5p\100tamias.net"} = "rjk\100linguist.dartmouth.edu";
156 $map{"sts\100accognoscere.org"} = "schubiger\100cpan.org";
157 $map{"s.payrard\100wanadoo.fr"} = "stef\100mongueurs.net";
158 $map{"richard.foley\100ubs.com"} = "richard.foley\100ubsw.com";
159 # I assume that Ton Hopsel's lack of e-mail address in AUTHORS is deliberate
160 $map{"me-02\100ton.iguana.be"} = $map{"perl-5.8.0\100ton.iguana.be"}
161   = $map{"perl5-porters\100ton.iguana.be"} = "!";
162 # No real name for these address
163 $map{$_} = "?" foreach ("grommel\100sears.com", "pxm\100nubz.org",
164                         "padre\100elte.hu", "jdhedden\100" . "1979.usna.com",
165                         "nothingmuch\100woobling.org", "bob\100starlabs.net",
166                         "bbucklan\100jpl-devvax.jpl.nasa.gov",
167                         "bilbo\100ua.fm", "mats\100sm5sxl.net",
168                         "chris\100ex-parrot.com", 
169                         "kaminsky\100math.huji.ac.il",
170                         "bonefish\100cs.tu-berlin.de",
171                         "bstrand\100switchmanagement.com",
172                         "glasser\100tang-eleven-seventy-nine.mit.edu",
173                         "raf\100tradingpost.com.au", "erik\100cs.uni-jena.de",
174                         "jms\100mathras.comcast.net", "kvr\100centrum.cz",
175                         "perlbug\100veggiechinese.net",
176                         "scott\100perlcode.org",
177                        );
178 # We don't have an e-mail address for Beau Cox
179 $map{"beau\100beaucox.com"} = "?";
180
181 $map{"rgarciasuarez\100mandrakesoft.com"}
182   = $map{"rgarciasuarez\100mandriva.com"}
183   = $map{"rgarciasuarez\100gmail.com"}
184   = $map{"raphel.garcia-suarez\100hexaflux.com"} = "rgs";
185 $map{"jhietaniemi\100gmail.com"} = $map{"jhi\100kosh.hut.fi"}
186   = $map{"jhi\100cc.hut.fi"} = $map{"jarkko.hietaniemi\100nokia.com"} = "jhi";
187 $map{"nick\100ccl4.org"} = $map{"nick\100talking.bollo.cx"}
188   = $map{"nick\100plum.flirble.org"} = $map{"nick\100babyhippo.co.uk"}
189   = $map{"nick\100bagpuss.unfortu.net"} = "nicholas";
190 $map{"craig.berry\100psinetcs.com"} = $map{"craig.berry\100metamorgs.com"}
191   = $map{"craig.berry\100signaltreesolutions.com"}
192   = $map{"craigberry\100mac.com"} = "craigb";
193 $map{"davem\100iabyn.nospamdeletethisbit.com" }
194   = $map{"davem\100fdgroup.co.uk"} = $map{"davem\100fdisolutions.com"}
195  = "davem";
196 $map{"alan.burlison\100uk.sun.com"} = "alanbur";
197 $map{"artur\100contiller.se"} = $map{"arthur\100contiller.se"} = "sky";
198 $map{"h.m.brand\100hccnet.nl"} = $map{"merijn\100l1.procura.nl"} = "merijn";
199 $map{"nik\100tiuk.ti.com"} = $map{"nick.ing-simmons\100elixent.com"} = "nick";
200 $map{"hv\100crypt.org"} = "hv";
201 $map{"gisle\100aas.no"} = "gisle";
202 $map{"gsar\100cpan.org"} = "gsar";
203
204 if (@authors) {
205   my %raw;
206   foreach my $filename (@authors) {
207     open FH, "<$filename" or die "Can't open $filename: $!";
208     while (<FH>) {
209       next if /^\#/;
210       next if /^-- /;
211       if (/<([^>]+)>/) {
212         # Easy line.
213         $raw{$1}++;
214       } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
215         # Name only
216         $untraced{$1}++;
217       } else {
218         chomp;
219         warn "Can't parse line '$_'";
220       }
221     }
222   }
223   foreach (keys %raw) {
224     print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
225     $_ = lc $_;
226     $authors{$map{$_} || $_}++;
227   }
228   ++$authors{'!'};
229   ++$authors{'?'};
230 }
231
232 while (<>) {
233   next if /^-+/;
234   if (m!^\[\s+(\d+)\]\s+By:\s+(\S+)\s+on!) {
235     # new patch
236     my @new = ($1, $2);
237     &process ($committer, $patch, $log);
238     ($patch, $committer) = @new;
239     undef $log;
240   } elsif (s/^(\s+Log: )//) {
241     die "Duplicate Log:" if $log;
242     $log = $_;
243     my $prefix = " " x length $1;
244     LOG: while (<>) {
245       next if /^$/;
246       s/^\t/        /;
247       if (s/^$prefix//) {
248         $log .= $_;
249       } elsif (/^\s+Branch:/) {
250         last LOG;
251       } else {
252         chomp;
253         die "Malformed log end with '$_'";
254       }
255     }
256   }
257 }
258
259 &process ($committer, $patch, $log);
260
261 if ($rank) {
262   &display_ordered(\%patchers);
263 } elsif ($ta) {
264   &display_ordered(\%committers);
265 } elsif (%authors) {
266   my %missing;
267   foreach (sort keys %patchers) {
268     next if $authors{$_};
269     # Sort by number of patches, then name.
270     $missing{$patchers{$_}}->{$_}++;
271   }
272   foreach my $patches (sort {$b <=> $a} keys %missing) {
273     print "$patches patch(es)\n";
274     foreach my $author (sort keys %{$missing{$patches}}) {
275       print "  $author\n";
276     }
277   }
278 }
279
280 sub display_ordered {
281   my $what = shift;
282   my @sorted;
283   my $total;
284   while (my ($name, $count) = each %$what) {
285     push @{$sorted[$count]}, $name;
286     $total += $count;
287   }
288
289   my $i = @sorted;
290   return unless @sorted;
291   my $sum = 0;
292   foreach my $i ($reverse ? 0 .. $#sorted : reverse 0 .. $#sorted) {
293     next unless $sorted[$i];
294     my $prefix;
295     $sum += $i * @{$sorted[$i]};
296     # Value to display is either this one, or the cumulative sum.
297     my $value = $cumulative ? $sum : $i;
298     if ($percentage) {
299         $prefix = sprintf "%6.2f:\t", 100 * $value / $total;
300     } else {
301         $prefix = "$value:\t";
302     }
303     print wrap ($prefix, "\t", join (" ", sort @{$sorted[$i]}), "\n");
304   }
305 }
306
307 sub process {
308   my ($committer, $patch, $log) = @_;
309   return unless $committer;
310   my @authors = $log =~ /From:\s+.*?([^"\@ \t\n<>]+\@[^"\@ \t\n<>]+)/gm;
311
312   if (@authors) {
313     foreach (@authors) {
314       s/^<//;
315       s/>$//;
316       $_ = lc $_;
317       $patchers{$map{$_} || $_}++;
318     }
319     # print "$patch: @authors\n";
320     ++$committers{$committer};
321   } else {
322     # print "$patch: $committer\n";
323     # Not entirely fair as this means that the maint pumpking scores for
324     # everything intergrated that wasn't a third party patch in blead
325     $patchers{$committer}++;
326   }
327 }
328
329