~ubuntu-branches/ubuntu/hoary/postfix/hoary-security

« back to all changes in this revision

Viewing changes to mantools/make-relnotes

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-10-06 11:50:33 UTC
  • Revision ID: james.westby@ubuntu.com-20041006115033-ooo6yfg6kmoteu04
Tags: upstream-2.1.3
ImportĀ upstreamĀ versionĀ 2.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
9
 
10
# Output format: each category is printed with a little header and
 
11
# each paragraph is tagged with [Incompat yyyymmdd] or with [Feature
 
12
# yyyymmdd].
 
13
 
 
14
%leader = (); %body = ();
 
15
$append_to = \%leader;
 
16
 
 
17
while (<>) {
 
18
 
 
19
    if (/^Incompatible changes with/) {
 
20
        die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
 
21
        $append_to = \%body;
 
22
        $prefix = "[Incompat $1] ";
 
23
        while (<>) {
 
24
            last if /^====/;
 
25
        }
 
26
        next;
 
27
    }
 
28
 
 
29
    if (/^Major changes with/) {
 
30
        die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
 
31
        $append_to = \%body;
 
32
        $prefix = "[Feature $1] ";
 
33
        while (<>) {
 
34
            last if /^====/;
 
35
        }
 
36
        next;
 
37
    }
 
38
 
 
39
    if (/^\s*\n/) {
 
40
        if ($paragraph) {
 
41
            for $class (@classes) {
 
42
                ${$append_to}{$class} .= $prefix . $paragraph . $_;
 
43
            }
 
44
            $paragraph = "";
 
45
        }
 
46
    } else {
 
47
        if ($paragraph eq "") {
 
48
            if ($append_to eq \%leader) {
 
49
                @classes = ("default");
 
50
                $paragraph = $_;
 
51
            } else {
 
52
                die "No [class] at start of paragraph: $_" 
 
53
                    unless /^\[([^]]+)\]\s*(.*)/s;
 
54
                $paragraph = $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
            }
 
62
        } else {
 
63
            $paragraph .= $_;
 
64
        }
 
65
    }
 
66
}
 
67
 
 
68
if ($paragraph) {
 
69
    for $class (@classes) {
 
70
        ${$append_to}{$class} .= $prefix . $paragraph . $_;
 
71
    }
 
72
}
 
73
 
 
74
print $leader{"default"}; 
 
75
 
 
76
for $class (sort keys %body) {
 
77
    print "Major changes - $class\n";
 
78
    print "----------------------\n\n";
 
79
    print $body{$class};
 
80
}