make-relnotes revision 1.1.1.1.2.3 1 #!/usr/bin/perl
2
3 # Transform RELEASE_NOTES, split into "leader", and "major changes",
4 # split into major categories, and prepend dates to paragraphs.
5 #
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.
11 #
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].
15
16 %leader = (); %body = ();
17 $append_to = \%leader;
18
19 while (<>) {
20
21 if (/^(Incompatible changes|Incompatibility) 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 /^====/;
27 }
28 next;
29 }
30
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 /^====/;
37 }
38 next;
39 }
40
41 if (/^\s*\n/) {
42 if ($paragraph) {
43 for $class (@classes) {
44 ${$append_to}{$class} .= $paragraph . $_;
45 }
46 $paragraph = "";
47 }
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 = $_;
63 }
64 } else {
65 $paragraph .= $_;
66 }
67 }
68 }
69
70 if ($paragraph) {
71 for $class (@classes) {
72 ${$append_to}{$class} .= $prefix . $paragraph . $_;
73 }
74 }
75
76 print $leader{"default"};
77
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};
83 }
84