Re: Changelogs on kernel.org

Marcus Alanen
2002-05-13T13:08:40Z

On Mon, 13 May 2002, Tomas Szepe wrote:

> > The original mode you requested prints the e-mail address, I guess
> > it should be the author's real name to look more nice.
> Okay.. how about the name db? That seems to be the last feature missing.

Yes, ok with Matthias I hope?

> s/^\s*(.*)\s*$/$1/;
> s/^\[?PATCH\]?\s*//;
>
> will be sufficient I believe. Also, the "/g" is not a good idea.

Agreed. Added /i for case-insensitivity. Also, e-mail addresses must
be at beginning of line, otherwise it is too easily confused.

Somebody make the mode changeable via command-line option...

So is any of this usable?

Short mode:

<adam@nmt.edu>
o 3ware driver update for 2.5.8-pre1

<adilger@clusterfs.com>
o Add three scripts for BK users, to Documentation/BK-usage:

<agrover@dexter.groveronline.com>
o ACPI interpreter update.
o MADT parsing improvements (Paul D & Richard Schaal)
o ACPI driver updates

Original mode:

o loop deadlock fix Andrew Morton
o ->setattr() locking changes Andrew Morton
o Various minor bug fixes for 3c59x net driver. Andrew Morton
o This fixes the "i_blocks went wrong when the disk filled up"
Andrew Morton
o ext3 filesystem sync mount speedup: Andrew Morton
o ext2_fill_super breakage Andrew Morton
o Fix jiffies-comparison timeout bug in arlan net driver. Alan Cox
o ppc64: update for pte in highmem changes anton@samba.org

#!/usr/bin/perl -w

# This Perl script is meant to simplify BK ChangeLogs for the linux
# kernel.
#
# (C) Copyright 2002 by Matthias Andree <matthias.andree@gmx.de>,
# Marcus Alanen <maalanen@abo.fi>
#
# ----------------------------------------------------------------------
# Distribution of this script is permitted under the terms of the
# GNU General Public License (GNU GPL) v2.
# ----------------------------------------------------------------------

# This program expects its input in the following format:
# (E-Mail Addresses MUST NOT bear leading white space!)
#
# <email@ddr.ess>
# changelog text
# more changelog text
# <email@ddr.ess>
# yet another changelog
# <another@add.ress>
# changelog #3
# more lines
#
# Groups and sorts the entries by email address:
#
# another@add.ress:
# changelog #3
# email@ddr.ess
# changelog text
# yet another changelog
#
# There are three different modes:
# - Short mode (one changelog == one line)
# - Full mode (changelogs separated by dashed line)
# - Original mode (one line consisting of changelog and author)
#
# Where possible, also adds the real name of the author using
# a static hash %addresses
#

use strict;

# 0 for short, 1 for full, 2 for "original changelog"
my $mode = 2;

# minimum space between entry and author for the original mode
my $space = 5;

# the key is the email address in ALL LOWER CAPS!
# the value is the real name of the person
my %addresses = (
'aia21@cantab.net' => 'Anton Altaparmakov',
'ak@muc.de' => 'Andi Kleen',
'akpm@zip.com.au' => 'Andrew Morton',
'alan@lxorguk.ukuu.org.uk' => 'Alan Cox',
'andrea@suse.de' => 'Andrea Arcangeli',
'ankry@green.mif.pg.gda.pl' => 'Andrzej Krzysztofowicz',
'axboe@suse.de' => 'Jens Axboe',
'bgerst@didntduck.org' => 'Brian Gerst',
'dalecki@evision-ventures.com' => 'Martin Dalecki',
'davem@redhat.com' => 'David S. Miller',
'davidel@xmailserver.org' => 'Davide Libenzi',
'green@namesys.com' => 'Oleg Drokin',
'hch@infradead.org' => 'Christoph Hellwig',
'jgarzik@mandrakesoft.com' => 'Jeff Garzik',
'jsimmons@heisenberg.transvirtual.com' => 'James Simmons',
'jsimmons@transvirtual.com' => 'James Simmons',
'kaos@ocs.com.au' => 'Keith Owens',
'lm@bitmover.com' => 'Larry McVoy',
'manfred@colorfullife.com' => 'Manfred Spraul',
'neilb@cse.unsw.edu.au' => 'Neil Brown',
'paulus@samba.org' => 'Paul Mackerras',
'perex@suse.cz' => 'Jaroslav Kysela',
'rgooch@ras.ucalgary.ca' => 'Richard Gooch',
'rmk@arm.linux.org.uk' => 'Russell King',
'szepe@pinerecords.com' => 'Tomas Szepe',
'torvalds@transmeta.com' => 'Linus Torvalds',
'viro@math.psu.edu' => 'Alexander Viro',
'~~~~~~thisentrylastforconvenience~~~~~' => 'Cesar Brutus Anonymous'
);

my %people = ();
my $addr = "";
my @cur = ();

sub append_item() {
if (!$addr) {
return;
}
if (!$people{$addr}) {
@{$people{$addr}} = ();
}
push @{$people{$addr}}, [@cur];

@cur = ();
}

while (<>) {
# Match address
if (/^<([^>]+)>/) {
# Add old item (if any) before beginning new
append_item();
$addr = $1;
} elsif ($addr) {
# Add line to patch
s/^\s*(.*)\s*$/$1/;
$_ =~ s/\[?PATCH\]?\s*//i;
push @cur, "$_\n";
} else {
# Header information
print;
}
}
append_item();

# get name associated to an email address
sub rmap_address {
#my @i = map { lc; } @_;
my @o = map {defined $addresses{lc $_} ? $addresses{lc $_} : $_ } @_;
return wantarray ? @o : $o[0];
}

sub print_items($) {
my $person = $_[0];
my $realname = rmap_address($person);
my @items = @{$people{$person}};
# Vain attempt to sort patches from one address
@items = sort @items;
if ($mode == 0 or $mode == 1) {
if ($realname ne $person) {
print "$realname ";
}
print "<$person>\n";
}
while ($_ = shift @items) {
if ($mode == 0) {
print "\to " . @$_[0];
} elsif ($mode == 1) {
print "\t------------------------------------------------------------\n";
foreach $_ (@$_) {
print "\t$_";
}
} elsif ($mode == 2) {
$_ = @$_[0];
chop;
$_ = "o $_";
# Split it onto two lines if necessary
if (length("$_ . $realname") > 76 - $space) {
print ("$_\n" . " " x (76-length($realname)) . "$realname\n");
} else {
print ("$_" . " " x (76-length($realname)-length($_)) . "$realname\n");
}
}
}
}

# Print the information
foreach $addr (sort keys %people) {
print_items($addr);
if ($mode != 2) { print "\n"; }
}

--
Marcus Alanen * Department of Computer Science * http://www.cs.abo.fi/
maalanen@abo.fi