| 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", |
| 32 | merijn => "h.m.brand\100xs4all.nl", |
| 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", |
| 39 | steveh => "steve.hay\100uk.radan.com", |
| 40 | stevep => "steve\100fisharerojo.org", |
| 41 | gisle => "gisle\100activestate.com", |
| 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", |
| 53 | "nospam-abuse\100bloodgate.com" => "tels\100bloodgate.com", |
| 54 | "jfriedl\100yahoo.com" => "jfriedl\100yahoo-inc.com", |
| 55 | "japhy\100pobox.com" => "japhy\100pobox.org", |
| 56 | "gellyfish\100gellyfish.com" => "jns\100gellyfish.com", |
| 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", |
| 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", |
| 82 | # Maybe we should special case this to get real names out? |
| 83 | "perlbug\100perl.org" => "perlbug-followup\100perl.org", |
| 84 | ); |
| 85 | |
| 86 | # Make sure these are all lower case. |
| 87 | |
| 88 | $map{"alan.burlison\100uk.sun.com"} = "alanbur"; |
| 89 | $map{"artur\100contiller.se"} = $map{"arthur\100contiller.se"} = "sky"; |
| 90 | $map{"autrijus\100egb.elixus.org"} = $map{"autrijus\100geb.elixus.org"} |
| 91 | = "autrijus\100autrijus.org"; |
| 92 | $map{"craig.berry\100psinetcs.com"} = $map{"craig.berry\100metamorgs.com"} |
| 93 | = $map{"craig.berry\100signaltreesolutions.com"} |
| 94 | = $map{"craigberry\100mac.com"} = "craigb"; |
| 95 | $map{"davem\100iabyn.nospamdeletethisbit.com" } |
| 96 | = $map{"davem\100fdgroup.co.uk"} = "davem"; |
| 97 | $map{"ilya\100math.ohio-state.edu"} = $map{"ilya\100math.berkeley.edu"} |
| 98 | = $map{"ilya\100math.berkeley.edu"} = "nospam-abuse\100ilyaz.org"; |
| 99 | $map{"jhietaniemi\100gmail.com"} = $map{"jhi\100kosh.hut.fi"} |
| 100 | = $map{"jhi\100cc.hut.fi"} = "jhi"; |
| 101 | $map{"nick\100ccl4.org"} = $map{"nick\100talking.bollo.cx"} |
| 102 | = $map{"nick\100plum.flirble.org"} = $map{"nick\100babyhippo.co.uk"} |
| 103 | = $map{"nick\100bagpuss.unfortu.net"} = "nicholas"; |
| 104 | $map{"philip.newton\100gmx.net"} = $map{"philip.newton\100datenrevision.de"} |
| 105 | = $map{"pnewton\100gmx.de"} = "pne\100cpan.org", |
| 106 | $map{"rgarciasuarez\100mandrakesoft.com"} |
| 107 | = $map{"rgarciasuarez\100mandriva.com"} |
| 108 | = $map{"raphel.garcia-suarez\100hexaflux.com"} = "rgs"; |
| 109 | $map{"simon\100pembro4.pmb.ox.ac.uk"} = $map{"simon\100brecon.co.uk"} |
| 110 | = $map{"simon\100othersideofthe.earth.li"} = $map{"simon\100cozens.net"} |
| 111 | = $map{"simon\100netthink.co.uk"} = "simon\100simon-cozens.org"; |
| 112 | $map{"spider\100web.zk3.dec.com"} = $map{"spider\100leggy.zk3.dec.com"} |
| 113 | = $map{"spider-perl\100orb.nashua.nh.us"} |
| 114 | = $map{"spider\100peano.zk3.dec.com"} |
| 115 | = "spider\100orb.nashua.nh.us"; |
| 116 | $map{"nik\100tiuk.ti.com"} = "nick"; |
| 117 | |
| 118 | $map{"a.koenig\100mind.de"} = "andreas.koenig\100anima.de"; |
| 119 | $map{"japhy\100perlmonk.org"} = $map{"japhy\100cpan.org"} |
| 120 | = "japhy\100pobox.com"; |
| 121 | $map{"rmbarker\100cpan.org"} = "robin.barker\100npl.co.uk"; |
| 122 | |
| 123 | $map{"h.m.brand\100hccnet.nl"} = $map{"merijn\100l1.procura.nl"} = "merijn"; |
| 124 | |
| 125 | $map{"yves.orton\100de.mci.com"} = $map{"yves.orton\100mciworldcom.de"} |
| 126 | = "demerphq\100gmail.com"; |
| 127 | $map{"jim.cromie\100gmail.com"} = "jcromie\100divsol.com"; |
| 128 | $map{"perl_dummy\100bloodgate.com"} = "nospam-abuse\100bloodgate.com"; |
| 129 | $map{"paul.marquess\100ntlworld.com"} = "paul.marquess\100btinternet.com"; |
| 130 | $map{"konovalo\100mail.wplus.net"} = $map{"vadim\100vkonovalov.ru"} |
| 131 | = "vkonovalov\100spb.lucent.com"; |
| 132 | $map{"kane\100cpan.org"} = "kane\100dwim.org"; |
| 133 | $map{"rs\100crystalflame.net"} = "p5-authors\100crystalflame.net"; |
| 134 | |
| 135 | $map{"hv\100crypt.org"} = "hv"; |
| 136 | $map{"gisle\100aas.no"} = "gisle"; |
| 137 | |
| 138 | if (@authors) { |
| 139 | my %raw; |
| 140 | foreach my $filename (@authors) { |
| 141 | open FH, "<$filename" or die "Can't open $filename: $!"; |
| 142 | while (<FH>) { |
| 143 | next if /^\#/; |
| 144 | next if /^-- /; |
| 145 | if (/<([^>]+)>/) { |
| 146 | # Easy line. |
| 147 | $raw{$1}++; |
| 148 | } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) { |
| 149 | # Name only |
| 150 | $untraced{$1}++; |
| 151 | } else { |
| 152 | chomp; |
| 153 | warn "Can't parse line '$_'"; |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | foreach (keys %raw) { |
| 158 | print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1; |
| 159 | $_ = lc $_; |
| 160 | $authors{$map{$_} || $_}++; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | while (<>) { |
| 165 | next if /^-+/; |
| 166 | if (m!^\[\s+(\d+)\]\s+By:\s+(\S+)\s+on!) { |
| 167 | # new patch |
| 168 | my @new = ($1, $2); |
| 169 | &process ($committer, $patch, $log); |
| 170 | ($patch, $committer) = @new; |
| 171 | undef $log; |
| 172 | } elsif (s/^(\s+Log: )//) { |
| 173 | die "Duplicate Log:" if $log; |
| 174 | $log = $_; |
| 175 | my $prefix = " " x length $1; |
| 176 | LOG: while (<>) { |
| 177 | next if /^$/; |
| 178 | if (s/^$prefix//) { |
| 179 | $log .= $_; |
| 180 | } elsif (/^\s+Branch:/) { |
| 181 | last LOG; |
| 182 | } else { |
| 183 | chomp; |
| 184 | die "Malformed log end with '$_'"; |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | &process ($committer, $patch, $log); |
| 191 | |
| 192 | if ($rank) { |
| 193 | &display_ordered; |
| 194 | } elsif (%authors) { |
| 195 | my %missing; |
| 196 | foreach (sort keys %patchers) { |
| 197 | next if $authors{$_}; |
| 198 | # Sort by number of patches, then name. |
| 199 | $missing{$patchers{$_}}->{$_}++; |
| 200 | } |
| 201 | foreach my $patches (sort {$b <=> $a} keys %missing) { |
| 202 | print "$patches patch(es)\n"; |
| 203 | foreach my $author (sort keys %{$missing{$patches}}) { |
| 204 | print " $author\n"; |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | sub display_ordered { |
| 210 | my @sorted; |
| 211 | while (my ($name, $count) = each %patchers) { |
| 212 | push @{$sorted[$count]}, $name; |
| 213 | } |
| 214 | |
| 215 | my $i = @sorted; |
| 216 | while (--$i) { |
| 217 | next unless $sorted[$i]; |
| 218 | print wrap ("$i:\t", "\t", join (" ", sort @{$sorted[$i]}), "\n"); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | sub process { |
| 223 | my ($committer, $patch, $log) = @_; |
| 224 | return unless $committer; |
| 225 | my @authors = $log =~ /From:.+\s+([^\@ \t\n]+\@[^\@ \t\n]+)/gm; |
| 226 | |
| 227 | if (@authors) { |
| 228 | foreach (@authors) { |
| 229 | s/^<//; |
| 230 | s/>$//; |
| 231 | $_ = lc $_; |
| 232 | $patchers{$map{$_} || $_}++; |
| 233 | } |
| 234 | # print "$patch: @authors\n"; |
| 235 | } else { |
| 236 | # print "$patch: $committer\n"; |
| 237 | # Not entirely fair as this means that the maint pumpking scores for |
| 238 | # everything intergrated that wasn't a third party patch in blead |
| 239 | $patchers{$committer}++; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | |