#!/usr/bin/perl $author = ""; %authors; @ctext; $authors{"rene"} = "Rene Rebe"; $authors{"valentin"} = "Valentin Ziegler"; $authors{"george"} = "Juergen \"George\" Sawinski"; $authors{"jsaw"} = "Juergen \"George\" Sawinski"; $authors{"mnemoc"} = "Alejandro Mery"; $authors{"amery"} = "Alejandro Mery"; $authors{"miguel"} = "Miguel Bolanos"; $authors{"miguelb"} = "Miguel Bolanos"; $authors{"lars"} = "Lars Kuhtz"; $authors{"susan"} = "Susanne Klaus"; $authors{"martin"} = "Martin Baum"; $authors{"jeru"} = "Christian Wiese"; $authors{"chris"} = "Christian Wiese"; $authors{"mtr"} = "Michael Troß"; $authors{"ragnar"} = "Roland Schulz"; $authors{"mika"} = "Mika Pesu"; $authors{"sebastian"} = "Sebastian Czech"; $authors{"msluis"} = "Minto van der Sluis"; $authors{"knigits"} = "Tony Collins"; $authors{"cr"} = "CR"; $authors{"clifford"} = "Clifford Wolf"; sub mylowwithtab { @param = @_; foreach (@param) { tr/A-Z/a-z/ ; s/^/\t/ }; return $param[0]; } sub print_text { foreach $key (sort keys %text) { print "\n" . $key . ":\n\n"; print @{$text{$key}}; } print "\n"; } while (<>) { # skip empty lines if (/^[ ]*$/) { next; } # skip junk lines if (/======================/) { next; } if (/^Index: /) { next; } # other junk if (/^-- *$/) { next; } if (/ *E-gards: Jimmy */) { next; } # skip submaster lines (at leasst for now) if (/^\[[0-9]*\] (.*)$/) { next; } if (/^[0-9]* \[by .*\]$/) { next; } # skip svk junk if (/^ *r[0-9]*[@].*: .*$/) { next; } # sync on ---* line if (/------------/) { # if we already had a last block to parse, output it if (! $author) { next; } # new date?, output it if ($date ne $ldate) { # output last gathered content text print_text; # output new date print "*) " . $date . "\n"; %text = (); $ldate = $date; } # do we have a valid author? # trailing collon, at least two capital chars _and_ no stray collon if ($ctext[0] =~ /^.*[A-Z][a-z].*[^:][A-Z][a-z].*: */) { $rauthor = $ctext[0]; shift @ctext; } # trailing collon, compact names only (fake, Darix, A-Tui, ...) elsif ($ctext[0] =~ /^[a-zA-Z][a-zA-Z@\.\-]*:[ ]*$/) { $rauthor = $ctext[0]; shift @ctext; } # some email address < @ > elsif ($ctext[0] =~ /<.*@.*>/) { $rauthor = $ctext[0]; shift @ctext; } # real name test - obvious elsif ($ctext[0] =~ /^[A-Z][a-z]* [A-Z][a-z]*$/) { $rauthor = $ctext[0]; shift @ctext; } # we need to guess an author else { $rauthor = $authors{$author}; } if ($rauthor) { $rauthor =~ s/ *:* *\n//; } else { $rauthor = "(no author)"; } # remove trailing whitesapces $rauthor =~ s/^ *//; # guess parsing or copy mode ? $line = $ctext[0]; if ($line =~ /\t\* .* /) { $copy = 1; } else { $copy = 0; } # parse the main content $i = 0; foreach $line (@ctext) { if ($copy == 1) { push @{$text{$rauthor}}, $rev if $i == 0; push @{$text{$rauthor}}, $line; } else { # strip leading whitespaces (sometimes '\t ' ...) #if ($line=~ /^[a-zA-Z0-9\[\(\{\<\>\}\)\}\] '":;,.\*_\-\+\/#\$\!].*$/) { # $line = "\t" . $line; # $line =~ s/^\t +/\t/ #} $line =~ s/^[ \t]*/\t/; # remove non-standard circles $line =~ s/^\t- */\t/; # lowercase the first charakter ... $line =~ s/^\t([A-Z])([a-z])/mylowwithtab ($1) . $2/e; # fixup embedded versions # silo-1.3.2 $line =~ s/([a-zA-Z_]+)-([0-9][0-9.a-zA-Z_+-]+)/$1 ($2)/g; # bluez-libs -> 2.6 $line =~ s/([a-zA-Z_][a-zA-Z]+) *-> *([0-9][0-9.a-zA-Z_-]+)/$1 ($2)/g; # 4.9.6 -> 4.9.10 $line =~ s/ ([0-9][0-9.a-zA-Z_+-]+) *-> *([0-9][0-9.a-zA-Z_+-]+)/ ($1 -> $2)/g; # insert space ... between * and the first char ... $line =~ s/^\t\*([a-zA-Z]+)/\t* $1/; # add circle $line =~ s/^\t([^\*])/\t* $1/; # some more stray junk $line =~ s/Package/package/; $line =~ s/\* adds /* added /; $line =~ s/\* add /* added /; $line =~ s/\* aded /* added /; $line =~ s/\* new /* added /; $line =~ s/\* fix /* fixed /; $line =~ s/\* fxed /* fixed /; $line =~ s/\* updates /* updated /; $line =~ s/\* update /* updated /; $line =~ s/\* udated /* updated /; $line =~ s/\* upgraded /* updated /; $line =~ s/\* upgrade /* updated /; $line =~ s/\* upgdaded /* updated /; $line =~ s/\* urade /* updated /; $line =~ s/\* remove /* removed /; push @{$text{$rauthor}}, $rev if $i == 0; push @{$text{$rauthor}}, $line; } $i++; } @ctext = (); next; } # extract author and date if (/r[0-9]* \| [^|]* \| [^|]* \| [^|]*/) { # parse svn info $author = $_ ; $author =~ s/r[0-9]* \| ([^|]*) \| .*\n/\1/; $date = $_ ; $date =~ s/r[0-9]* .* (....\-..\-..) .*\n/\1/; $rev = $_ ; $rev =~ s/(r[0-9]*) .*\n/\1/; next; } # accumulate info block push (@ctext, $_); } #output last block print_text;