This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Oops. When the e-mail address came first, or there was no name with it,
[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
8my ($rank, @authors, %authors, %untraced, %patchers);
9my $result = GetOptions ("rank" => \$rank, # rank authors
10 "acknowledged=s" => \@authors); # authors files
11
12if (!$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
16Specify stdin as - if needs be. Remember that option names can be abbreviated.
17EOS
18}
19
20my %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",
3bd76f0a 32 merijn => "h.m.brand\100xs4all.nl",
5649b9c9
NC
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",
5e266217
NC
39 steveh => "steve.hay\100uk.radan.com",
40 stevep => "steve\100fisharerojo.org",
a7ad7795 41 gisle => "gisle\100activestate.com",
5649b9c9
NC
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",
a7ad7795 53 "nospam-abuse\100bloodgate.com" => "tels\100bloodgate.com",
5649b9c9
NC
54 "jfriedl\100yahoo.com" => "jfriedl\100yahoo-inc.com",
55 "japhy\100pobox.com" => "japhy\100pobox.org",
56 "gellyfish\100gellyfish.com" => "jns\100gellyfish.com",
a7ad7795
NC
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",
657b1971
NC
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",
18f651c1
NC
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",
5f9c001d 88 "phil\100perkpartners.com" => "phil\100finchcomputer.com",
39243be7
NC
89 "tom.horsley\100mail.ccur.com" => "tom.horsley\100ccur.com",
90 "rootbeer\100teleport.com" => "rootbeer\100redcat.com",
91 "cp\100onsitetech.com" => "publiustemp-p5p\100yahoo.com",
92 "epeschko\100den-mdev1" => "esp5\100pge.com",
93 "pimlott\100idiomtech.com" => "andrew\100pimlott.net",
94 "fugazi\100zyx.net" => "larrysh\100cpan.org",
95 "merijnb\100iloquent.nl" => "merijnb\100iloquent.com",
96 "whatever\100davidnicol.com" => "davidnicol\100gmail.com",
97 "rmgiroux\100acm.org" => "rmgiroux\100hotmail.com",
98 "smcc\100mit.edu" => "smcc\100ocf.berkeley.edu",
99 "steven\100accognoscere.org" => "schubiger\100cpan.org",
100 "!" => "me-02\100ton.iguana.be",
a7ad7795
NC
101 # Maybe we should special case this to get real names out?
102 "perlbug\100perl.org" => "perlbug-followup\100perl.org",
5649b9c9
NC
103 );
104
105# Make sure these are all lower case.
106
5649b9c9 107$map{"autrijus\100egb.elixus.org"} = $map{"autrijus\100geb.elixus.org"}
39243be7 108 = $map{"autrijus\100gmail.com"} = "autrijus\100autrijus.org";
5649b9c9
NC
109$map{"ilya\100math.ohio-state.edu"} = $map{"ilya\100math.berkeley.edu"}
110 = $map{"ilya\100math.berkeley.edu"} = "nospam-abuse\100ilyaz.org";
5649b9c9 111$map{"philip.newton\100gmx.net"} = $map{"philip.newton\100datenrevision.de"}
a7ad7795 112 = $map{"pnewton\100gmx.de"} = "pne\100cpan.org",
5649b9c9
NC
113$map{"simon\100pembro4.pmb.ox.ac.uk"} = $map{"simon\100brecon.co.uk"}
114 = $map{"simon\100othersideofthe.earth.li"} = $map{"simon\100cozens.net"}
115 = $map{"simon\100netthink.co.uk"} = "simon\100simon-cozens.org";
116$map{"spider\100web.zk3.dec.com"} = $map{"spider\100leggy.zk3.dec.com"}
117 = $map{"spider-perl\100orb.nashua.nh.us"}
118 = $map{"spider\100peano.zk3.dec.com"}
119 = "spider\100orb.nashua.nh.us";
5649b9c9
NC
120$map{"a.koenig\100mind.de"} = "andreas.koenig\100anima.de";
121$map{"japhy\100perlmonk.org"} = $map{"japhy\100cpan.org"}
122 = "japhy\100pobox.com";
123$map{"rmbarker\100cpan.org"} = "robin.barker\100npl.co.uk";
a7ad7795 124$map{"yves.orton\100de.mci.com"} = $map{"yves.orton\100mciworldcom.de"}
657b1971 125 = "demerphq\100gmail.com";
a7ad7795
NC
126$map{"jim.cromie\100gmail.com"} = "jcromie\100divsol.com";
127$map{"perl_dummy\100bloodgate.com"} = "nospam-abuse\100bloodgate.com";
128$map{"paul.marquess\100ntlworld.com"} = "paul.marquess\100btinternet.com";
657b1971
NC
129$map{"konovalo\100mail.wplus.net"} = $map{"vadim\100vkonovalov.ru"}
130 = "vkonovalov\100spb.lucent.com";
131$map{"kane\100cpan.org"} = "kane\100dwim.org";
132$map{"rs\100crystalflame.net"} = "p5-authors\100crystalflame.net";
18f651c1
NC
133$map{"(srezic\100iconmobile.com)"} = "slaven\100rezic.de";
134$map{"perl\100dellah.anu.edu.au"} = "spoon\100cpan.org";
39243be7
NC
135$map{"rjk-perl-p5p\100tamias.net"} = "rjk\100linguist.dartmouth.edu";
136$map{"sts\100accognoscere.org"} = "steven\100accognoscere.org";
6fbb3cd3
NC
137$map{"s.payrard\100wanadoo.fr"} = "stef\100mongueurs.net";
138
139$map{"rgarciasuarez\100mandrakesoft.com"}
140 = $map{"rgarciasuarez\100mandriva.com"}
141 = $map{"raphel.garcia-suarez\100hexaflux.com"} = "rgs";
142$map{"jhietaniemi\100gmail.com"} = $map{"jhi\100kosh.hut.fi"}
143 = $map{"jhi\100cc.hut.fi"} = "jhi";
144$map{"nick\100ccl4.org"} = $map{"nick\100talking.bollo.cx"}
145 = $map{"nick\100plum.flirble.org"} = $map{"nick\100babyhippo.co.uk"}
146 = $map{"nick\100bagpuss.unfortu.net"} = "nicholas";
147$map{"craig.berry\100psinetcs.com"} = $map{"craig.berry\100metamorgs.com"}
148 = $map{"craig.berry\100signaltreesolutions.com"}
149 = $map{"craigberry\100mac.com"} = "craigb";
150$map{"davem\100iabyn.nospamdeletethisbit.com" }
151 = $map{"davem\100fdgroup.co.uk"} = "davem";
152$map{"alan.burlison\100uk.sun.com"} = "alanbur";
153$map{"artur\100contiller.se"} = $map{"arthur\100contiller.se"} = "sky";
154$map{"h.m.brand\100hccnet.nl"} = $map{"merijn\100l1.procura.nl"} = "merijn";
155$map{"nik\100tiuk.ti.com"} = "nick";
a7ad7795
NC
156$map{"hv\100crypt.org"} = "hv";
157$map{"gisle\100aas.no"} = "gisle";
158
5649b9c9
NC
159if (@authors) {
160 my %raw;
161 foreach my $filename (@authors) {
162 open FH, "<$filename" or die "Can't open $filename: $!";
163 while (<FH>) {
164 next if /^\#/;
165 next if /^-- /;
166 if (/<([^>]+)>/) {
167 # Easy line.
168 $raw{$1}++;
169 } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
170 # Name only
171 $untraced{$1}++;
172 } else {
173 chomp;
174 warn "Can't parse line '$_'";
175 }
176 }
177 }
178 foreach (keys %raw) {
179 print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
180 $_ = lc $_;
181 $authors{$map{$_} || $_}++;
182 }
39243be7 183 $authors{'!'}++;
5649b9c9
NC
184}
185
186while (<>) {
187 next if /^-+/;
188 if (m!^\[\s+(\d+)\]\s+By:\s+(\S+)\s+on!) {
189 # new patch
190 my @new = ($1, $2);
191 &process ($committer, $patch, $log);
192 ($patch, $committer) = @new;
193 undef $log;
194 } elsif (s/^(\s+Log: )//) {
195 die "Duplicate Log:" if $log;
196 $log = $_;
197 my $prefix = " " x length $1;
198 LOG: while (<>) {
84fd1186 199 next if /^$/;
5649b9c9
NC
200 if (s/^$prefix//) {
201 $log .= $_;
202 } elsif (/^\s+Branch:/) {
203 last LOG;
204 } else {
84fd1186
NC
205 chomp;
206 die "Malformed log end with '$_'";
5649b9c9
NC
207 }
208 }
209 }
210}
211
212&process ($committer, $patch, $log);
213
214if ($rank) {
215 &display_ordered;
216} elsif (%authors) {
217 my %missing;
218 foreach (sort keys %patchers) {
219 next if $authors{$_};
220 # Sort by number of patches, then name.
221 $missing{$patchers{$_}}->{$_}++;
222 }
223 foreach my $patches (sort {$b <=> $a} keys %missing) {
224 print "$patches patch(es)\n";
225 foreach my $author (sort keys %{$missing{$patches}}) {
226 print " $author\n";
227 }
228 }
229}
230
231sub display_ordered {
232 my @sorted;
233 while (my ($name, $count) = each %patchers) {
234 push @{$sorted[$count]}, $name;
235 }
236
237 my $i = @sorted;
949c04ae 238 return unless $i;
5649b9c9
NC
239 while (--$i) {
240 next unless $sorted[$i];
241 print wrap ("$i:\t", "\t", join (" ", sort @{$sorted[$i]}), "\n");
242 }
243}
244
245sub process {
246 my ($committer, $patch, $log) = @_;
247 return unless $committer;
a45ec2f3 248 my @authors = $log =~ /From:\s+.*?([^"\@ \t\n]+\@[^"\@ \t\n]+)/gm;
5649b9c9
NC
249
250 if (@authors) {
251 foreach (@authors) {
252 s/^<//;
253 s/>$//;
254 $_ = lc $_;
255 $patchers{$map{$_} || $_}++;
256 }
257 # print "$patch: @authors\n";
258 } else {
259 # print "$patch: $committer\n";
260 # Not entirely fair as this means that the maint pumpking scores for
261 # everything intergrated that wasn't a third party patch in blead
262 $patchers{$committer}++;
263 }
264}
265
266