Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / mantools / make-relnotes
blob2cc5b4fe3f4eb7580d777b3cf992945ff011ba0b
1 #!/usr/bin/perl
3 # Transform RELEASE_NOTES, split into "leader", and "major changes",
4 # split into major categories, and prepend dates to paragraphs.
6 # Input format: the leader text is copied verbatim; each paragraph
7 # starts with [class, class] where a class specifies one or more
8 # categories that the change should be listed under. Adding class
9 # info is the only manual processing needed to go from a RELEASE_NOTES
10 # file to the transformed representation.
12 # Output format: each category is printed with a little header and
13 # each paragraph is tagged with [Incompat yyyymmdd] or with [Feature
14 # yyyymmdd].
16 %leader = (); %body = ();
17 $append_to = \%leader;
19 while (<>) {
21 if (/^Incompatible changes with/) {
22 die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
23 $append_to = \%body;
24 $prefix = "[Incompat $1] ";
25 while (<>) {
26 last if /^====/;
28 next;
31 if (/^Major changes with/) {
32 die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
33 $append_to = \%body;
34 $prefix = "[Feature $1] ";
35 while (<>) {
36 last if /^====/;
38 next;
41 if (/^\s*\n/) {
42 if ($paragraph) {
43 for $class (@classes) {
44 ${$append_to}{$class} .= $paragraph . $_;
46 $paragraph = "";
48 } else {
49 if ($paragraph eq "") {
50 if ($append_to eq \%leader) {
51 @classes = ("default");
52 $paragraph = $_;
53 } elsif (/^\[([^]]+)\]\s*(.*)/s) {
54 $paragraph = $prefix . $2;
55 ($junk = $1) =~ s/\s*,\s*/,/g;
56 $junk =~ s/^\s+//;
57 $junk =~ s/\s+$//;
58 #print "junk >$junk<\n";
59 @classes = split(/,+/, $junk);
60 #print "[", join(', ', @classes), "] ", $paragraph;
61 } else {
62 $paragraph = $_;
64 } else {
65 $paragraph .= $_;
70 if ($paragraph) {
71 for $class (@classes) {
72 ${$append_to}{$class} .= $prefix . $paragraph . $_;
76 print $leader{"default"};
78 for $class (sort keys %body) {
79 print "Major changes - $class\n";
80 ($junk = "Major changes - $class") =~ s/./-/g;
81 print $junk, "\n\n";
82 print $body{$class};