From: Tomas Szepe <szepe@pinerecords.com>
To: Marcus Alanen <maalanen@ra.abo.fi>
Cc: matthias.andree@gmx.de, riel@conectiva.com.br,
Johnny Mnemonic <johnny@themnemonic.org>,
linux-kernel@vger.kernel.org, Russell King <rmk@arm.linux.org.uk>
Subject: Re: Changelogs on kernel.org
Date: Mon, 13 May 2002 16:08:21 +0200 [thread overview]
Message-ID: <20020513140821.GB5134@louise.pinerecords.com> (raw)
In-Reply-To: <20020513120953.GD4258@louise.pinerecords.com> <Pine.LNX.4.44.0205131556550.23542-100000@tuxedo.abo.fi>
> Somebody make the mode changeable via command-line option...
Done... in a slightly different manner :)
cl:
- clean up
- indentation
- CMODE environment variable
./fmt /usr/src/ChangeLog-2.5.14 gives output in orig. mode
CMODE=2 ./fmt /usr/src/ChangeLog-2.5.14 gives output in orig. mode
CMODE=1 ./fmt /usr/src/ChangeLog-2.5.14 gives output in full mode
CMODE=0 ./fmt /usr/src/ChangeLog-2.5.14 gives output in terse mode
#!/usr/bin/perl -w
#
# This Perl script is meant to simplify/beautify BK ChangeLogs
# for the linux kernel.
#
# (C) Copyright 2002 by Matthias Andree <matthias.andree@gmx.de>,
# Marcus Alanen <maalanen@abo.fi>,
# Tomas Szepe <szepe@pinerecords.com>
#
# Version 0.90.
#
# ------------------------------------------------------------------
# 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 whitespace!)
#
# <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;
# CMODE environment variable selects output mode:
# 0 for short, 1 for full, 2 for "original changelog"
# (default is 2 if $CMODE unset)
#
my $mode = 2;
foreach my $en (keys(%ENV)) {
if ($en eq "CMODE") {
$mode = $ENV{CMODE};
if ($mode ne "0" && $mode ne "1" && $mode ne "2") {
print "CMODE has to be 0 for short, 1 for full, 2 for orig. Undefined defaults to 2.\n";
die();
}
}
}
# 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 = ();
}
# get name associated to an email address
sub rmap_address
{
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");
}
}
}
}
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();
# Print the information
foreach $addr (sort keys %people) {
print_items($addr);
if ($mode != 2) { print "\n"; }
}
next prev parent reply other threads:[~2002-05-13 14:08 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-12 0:07 Changelogs on kernel.org Ian Molton
2002-05-12 0:48 ` Diego Calleja
2002-05-12 1:09 ` john slee
2002-05-12 1:14 ` john slee
2002-05-12 5:05 ` Brian C. Huffman
2002-05-12 10:05 ` Johnny Mnemonic
2002-05-13 0:46 ` Rik van Riel
2002-05-13 11:52 ` Marcus Alanen
2002-05-13 12:09 ` Tomas Szepe
2002-05-13 13:08 ` Marcus Alanen
2002-05-13 14:08 ` Tomas Szepe [this message]
2002-05-13 14:45 ` Tomas Szepe
2002-05-13 14:06 ` Greg KH
2002-05-13 15:11 ` Tomas Szepe
2002-05-13 14:51 ` Greg KH
2002-05-13 15:58 ` Matthias Andree
2002-05-13 16:01 ` Freeze on 2.4.18 Pol
2002-05-13 15:21 ` Changelogs on kernel.org Matthias Andree
2002-05-13 22:05 ` Robinson Maureira Castillo
2002-05-13 23:41 ` Tomas Szepe
2002-05-14 8:44 ` Matthias Andree
2002-05-14 8:43 ` Matthias Andree
2002-05-14 9:23 ` Tomas Szepe
2002-05-13 11:58 ` Tomas Szepe
2002-05-13 12:39 ` Dave Gilbert (Home)
2002-05-13 13:01 ` Russell King
2002-05-13 13:27 ` Tomas Szepe
2002-05-13 13:42 ` Russell King
2002-05-13 15:12 ` Larry McVoy
2002-05-13 15:29 ` Tomas Szepe
2002-05-13 15:37 ` Larry McVoy
2002-05-12 9:14 ` Trever L. Adams
2002-05-12 20:06 ` Linus Torvalds
2002-05-12 20:20 ` Jeff Garzik
2002-05-12 20:31 ` Dr. David Alan Gilbert
2002-05-12 20:41 ` Arnaldo Carvalho de Melo
2002-05-13 20:57 ` Linus Torvalds
2002-05-14 0:29 ` Arnaldo Carvalho de Melo
2002-05-13 1:56 ` Linus Torvalds
2002-05-13 9:31 ` Matthias Andree
2002-05-13 8:52 ` Greg KH
2002-05-13 10:41 ` Matthias Andree
2002-05-13 10:12 ` Tomas Szepe
2002-05-13 10:17 ` Tomas Szepe
2002-05-13 13:00 ` Ian Molton
2002-05-12 20:31 ` Matthew D. Pitts
2002-05-12 20:35 ` Anton Altaparmakov
2002-05-12 21:04 ` HPFS and linux-2.4.18 Wojciech "Sas" Cieciwa
2002-05-12 21:17 ` Changelogs on kernel.org Florian Weimer
2002-05-12 21:42 ` Marcus Alanen
2002-05-12 22:12 ` Tomas Szepe
2002-05-13 10:32 ` Helge Hafting
2002-05-13 7:34 ` Kristian Peters
2002-05-12 21:51 ` Ian Molton
2002-05-12 21:47 ` Florian Weimer
2002-05-12 23:50 ` Sven.Riedel
2002-05-13 2:01 ` Linus Torvalds
2002-05-13 5:10 ` Jeff Garzik
2002-05-13 5:17 ` Larry McVoy
2002-05-13 10:37 ` Helge Hafting
2002-05-13 19:00 ` Jeff Garzik
2002-05-13 8:57 ` jw schultz
2002-05-13 8:06 ` Greg KH
[not found] <30386.1021456050@redhat.com>
2002-05-15 16:39 ` Linus Torvalds
2002-05-15 18:07 ` David Woodhouse
2002-05-15 19:20 ` Larry McVoy
2002-05-15 20:03 ` David Woodhouse
2002-05-15 20:08 ` Larry McVoy
2002-05-15 20:15 ` David Woodhouse
2002-05-15 20:34 ` Larry McVoy
2002-05-15 21:03 ` Kenneth Johansson
2002-05-15 22:30 ` Larry McVoy
2002-05-15 22:56 ` Kai Germaschewski
2002-05-15 22:59 ` Larry McVoy
2002-05-16 2:26 ` Horst von Brand
2002-05-16 7:02 ` Rusty Russell
2002-05-15 21:38 James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020513140821.GB5134@louise.pinerecords.com \
--to=szepe@pinerecords.com \
--cc=johnny@themnemonic.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maalanen@ra.abo.fi \
--cc=matthias.andree@gmx.de \
--cc=riel@conectiva.com.br \
--cc=rmk@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).