Commit | Line | Data |
---|---|---|
5649b9c9 NC |
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, @authors, %authors, %untraced, %patchers); | |
9 | my $result = GetOptions ("rank" => \$rank, # rank authors | |
10 | "acknowledged=s" => \@authors); # authors files | |
11 | ||
12 | if (!$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 | |
16 | Specify stdin as - if needs be. Remember that option names can be abbreviated. | |
17 | EOS | |
18 | } | |
19 | ||
20 | my %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", | |
5649b9c9 NC |
41 | "abigail\100abigail.nl"=> "abigail\100foad.org", |
42 | "chromatic\100wgz.org" => "chromatic\100rmci.net", | |
43 | "slaven\100rezic.de" => "slaven.rezic\100berlin.de", | |
44 | "mjtg\100cam.ac.uk" => "mjtg\100cus.cam.ac.uk", | |
45 | "robin.barker\100npl.co.uk" => "rmb1\100cise.npl.co.uk", | |
46 | "paul.marquess\100btinternet.com" | |
47 | => "paul_marquess\100yahoo.co.uk", | |
48 | "wolfgang.laun\100chello.at" => | |
49 | "wolfgang.laun\100alcatel.at", | |
50 | "t.jenness\100jach.hawaii.edu" => "timj\100jach.hawaii.edu", | |
51 | "abe\100ztreet.demon.nl" => "abeltje\100cpan.org", | |
52 | "perl_dummy\100bloodgate.com" => "tels\100bloodgate.com", | |
53 | "jfriedl\100yahoo.com" => "jfriedl\100yahoo-inc.com", | |
54 | "japhy\100pobox.com" => "japhy\100pobox.org", | |
55 | "gellyfish\100gellyfish.com" => "jns\100gellyfish.com", | |
56 | ); | |
57 | ||
58 | # Make sure these are all lower case. | |
59 | ||
60 | $map{"alan.burlison\100uk.sun.com"} = "alanbur"; | |
61 | $map{"artur\100contiller.se"} = $map{"arthur\100contiller.se"} = "sky"; | |
62 | $map{"autrijus\100egb.elixus.org"} = $map{"autrijus\100geb.elixus.org"} | |
63 | = "autrijus\100autrijus.org"; | |
64 | $map{"craig.berry\100psinetcs.com"} = $map{"craig.berry\100metamorgs.com"} | |
5e266217 NC |
65 | = $map{"craig.berry\100signaltreesolutions.com"} |
66 | = $map{"craigberry\100mac.com"} = "craigb"; | |
5649b9c9 NC |
67 | $map{"davem\100fdgroup.co.uk"} = "davem"; |
68 | $map{"ilya\100math.ohio-state.edu"} = $map{"ilya\100math.berkeley.edu"} | |
69 | = $map{"ilya\100math.berkeley.edu"} = "nospam-abuse\100ilyaz.org"; | |
70 | $map{"jhi\100kosh.hut.fi"} = $map{"jhi\100cc.hut.fi"} = "jhi"; | |
71 | $map{"nick\100ccl4.org"} = $map{"nick\100talking.bollo.cx"} | |
72 | = $map{"nick\100plum.flirble.org"} = $map{"nick\100babyhippo.co.uk"} | |
73 | = $map{"nick\100bagpuss.unfortu.net"} = "nicholas"; | |
74 | $map{"philip.newton\100gmx.net"} = $map{"philip.newton\100datenrevision.de"} | |
75 | = "pnewton\100gmx.de", | |
485444d2 NC |
76 | $map{"rgarciasuarez\100mandrakesoft.com"} |
77 | = $map{"rgarciasuarez\100mandriva.com"} | |
78 | = $map{"raphel.garcia-suarez\100hexaflux.com"} = "rgs"; | |
5649b9c9 NC |
79 | $map{"simon\100pembro4.pmb.ox.ac.uk"} = $map{"simon\100brecon.co.uk"} |
80 | = $map{"simon\100othersideofthe.earth.li"} = $map{"simon\100cozens.net"} | |
81 | = $map{"simon\100netthink.co.uk"} = "simon\100simon-cozens.org"; | |
82 | $map{"spider\100web.zk3.dec.com"} = $map{"spider\100leggy.zk3.dec.com"} | |
83 | = $map{"spider-perl\100orb.nashua.nh.us"} | |
84 | = $map{"spider\100peano.zk3.dec.com"} | |
85 | = "spider\100orb.nashua.nh.us"; | |
86 | $map{"nik\100tiuk.ti.com"} = "nick"; | |
87 | ||
88 | $map{"a.koenig\100mind.de"} = "andreas.koenig\100anima.de"; | |
89 | $map{"japhy\100perlmonk.org"} = $map{"japhy\100cpan.org"} | |
90 | = "japhy\100pobox.com"; | |
91 | $map{"rmbarker\100cpan.org"} = "robin.barker\100npl.co.uk"; | |
92 | ||
0fbf934d | 93 | $map{"h.m.brand\100hccnet.nl"} = $map{"merijn\100l1.procura.nl"} = "merijn"; |
074a06a8 | 94 | |
5649b9c9 NC |
95 | if (@authors) { |
96 | my %raw; | |
97 | foreach my $filename (@authors) { | |
98 | open FH, "<$filename" or die "Can't open $filename: $!"; | |
99 | while (<FH>) { | |
100 | next if /^\#/; | |
101 | next if /^-- /; | |
102 | if (/<([^>]+)>/) { | |
103 | # Easy line. | |
104 | $raw{$1}++; | |
105 | } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) { | |
106 | # Name only | |
107 | $untraced{$1}++; | |
108 | } else { | |
109 | chomp; | |
110 | warn "Can't parse line '$_'"; | |
111 | } | |
112 | } | |
113 | } | |
114 | foreach (keys %raw) { | |
115 | print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1; | |
116 | $_ = lc $_; | |
117 | $authors{$map{$_} || $_}++; | |
118 | } | |
119 | } | |
120 | ||
121 | while (<>) { | |
122 | next if /^-+/; | |
123 | if (m!^\[\s+(\d+)\]\s+By:\s+(\S+)\s+on!) { | |
124 | # new patch | |
125 | my @new = ($1, $2); | |
126 | &process ($committer, $patch, $log); | |
127 | ($patch, $committer) = @new; | |
128 | undef $log; | |
129 | } elsif (s/^(\s+Log: )//) { | |
130 | die "Duplicate Log:" if $log; | |
131 | $log = $_; | |
132 | my $prefix = " " x length $1; | |
133 | LOG: while (<>) { | |
84fd1186 | 134 | next if /^$/; |
5649b9c9 NC |
135 | if (s/^$prefix//) { |
136 | $log .= $_; | |
137 | } elsif (/^\s+Branch:/) { | |
138 | last LOG; | |
139 | } else { | |
84fd1186 NC |
140 | chomp; |
141 | die "Malformed log end with '$_'"; | |
5649b9c9 NC |
142 | } |
143 | } | |
144 | } | |
145 | } | |
146 | ||
147 | &process ($committer, $patch, $log); | |
148 | ||
149 | if ($rank) { | |
150 | &display_ordered; | |
151 | } elsif (%authors) { | |
152 | my %missing; | |
153 | foreach (sort keys %patchers) { | |
154 | next if $authors{$_}; | |
155 | # Sort by number of patches, then name. | |
156 | $missing{$patchers{$_}}->{$_}++; | |
157 | } | |
158 | foreach my $patches (sort {$b <=> $a} keys %missing) { | |
159 | print "$patches patch(es)\n"; | |
160 | foreach my $author (sort keys %{$missing{$patches}}) { | |
161 | print " $author\n"; | |
162 | } | |
163 | } | |
164 | } | |
165 | ||
166 | sub display_ordered { | |
167 | my @sorted; | |
168 | while (my ($name, $count) = each %patchers) { | |
169 | push @{$sorted[$count]}, $name; | |
170 | } | |
171 | ||
172 | my $i = @sorted; | |
173 | while (--$i) { | |
174 | next unless $sorted[$i]; | |
175 | print wrap ("$i:\t", "\t", join (" ", sort @{$sorted[$i]}), "\n"); | |
176 | } | |
177 | } | |
178 | ||
179 | sub process { | |
180 | my ($committer, $patch, $log) = @_; | |
181 | return unless $committer; | |
182 | my @authors = $log =~ /From:.+\s+([^\@ \t\n]+\@[^\@ \t\n]+)/gm; | |
183 | ||
184 | if (@authors) { | |
185 | foreach (@authors) { | |
186 | s/^<//; | |
187 | s/>$//; | |
188 | $_ = lc $_; | |
189 | $patchers{$map{$_} || $_}++; | |
190 | } | |
191 | # print "$patch: @authors\n"; | |
192 | } else { | |
193 | # print "$patch: $committer\n"; | |
194 | # Not entirely fair as this means that the maint pumpking scores for | |
195 | # everything intergrated that wasn't a third party patch in blead | |
196 | $patchers{$committer}++; | |
197 | } | |
198 | } | |
199 | ||
200 |