]> Pileus Git - ~andy/fetchmail/blob - makerelease
Another try at getting Debian changelogs right.
[~andy/fetchmail] / makerelease
1 #!/usr/bin/perl
2 #
3 # Make a fetchmail release.  Must be run as root, to make RPMs.
4 # Dumps a release notice and diffs as a MIME multipart message 
5 # in RELEASE_NOTES
6 #
7 $timezone = "EDT";
8
9 sub rfc822date
10 {
11     @wdays  = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
12     @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Nov", "Dec");
13
14     my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
15     "$wdays[$wday] $months[$mon] " . substr("0$mday", -2) . " " . substr("0$hour", -2) . ":" . substr("0$min", -2) . ":" . substr("0$sec", -2) . " $timezone " . (1900+$year);
16 }
17
18
19 $version=`grep 'VERSION *=' Makefile.in`;
20 $version =~ /VERSION *= *(.*)/;
21 $version = $1;
22 $rcsid = $version;
23 $rcsid =~ tr/./-/;
24
25 open(ID, "rlog -h NEWS|");
26 while (<ID>) {
27     last if /^symbolic names/;
28 }
29 while (<ID>) {
30     if (/^\t(.*):/) {
31         push(@versions, $1);
32     }
33 }
34 close(ID);
35
36 if ($versions[0] eq $rcsid) {
37     $rcsid = $versions[0];
38     $oldid = $versions[1];
39 } else {
40     $rcsid = '<workfile>';
41     $oldid = $versions[0];
42 }
43
44 #$ENV{'PATH'} = "~esr/bin:/bin:/usr/bin";
45
46 print "Building $version release, RCS ID $rcsid, previous RCS ID $oldid\n";
47
48 print "Test-building the software...\n";
49 if (system("su -c 'make >/dev/null' esr")) {
50         die("Compilation failure\n");
51 }
52
53 # Update the Debian logfile
54 open(DEBLOG, "debian/changelog");
55 $firstline = <DEBLOG>;
56 close(DEBLOG);
57 $firstline =~ /fetchmail \(*([^-]*)/;
58 $logvers = $1;
59 if ($version eq $logvers) {
60     print "No change to Debian logfile...\n";
61 } else {
62     $date = &rfc822date();
63     print "Updating the Debian logfile ($logvers -> $version)...\n";
64     open(DEBLOG, ">>debian/changelog");
65     print DEBLOG <<EOF;
66 fetchmail (${version}-1) unstable; urgency=low
67
68   * new upstream version
69   
70 -- Eric S. Raymond <esr\@thyrsus.com>  ${date}
71   
72 EOF
73     close(DEBLOG);
74 }
75
76 print "Building the distribution...\n";
77 if (system("su -c 'make dist >/dev/null' esr")) {
78         die("Distribution-build failure\n");
79 }
80
81 print "Building the RPMs...\n";
82 if (system("make rpm >/dev/null 2>/dev/null && chown esr *.rpm")) {
83         die("RPM-build failure\n");
84 }
85
86 open(REPORT, ">PREAMBLE.$$");
87
88 print REPORT <<EOF;
89 From: esr\@thyrsus.com (Eric S. Raymond)
90 To: fetchmail-announce\@ccil.org
91 Reply-To: esr\@thyrsus.com (Eric S. Raymond)
92 Subject: The $version release of fetchmail is available
93 FCC: ~/postings/outmail
94
95 The $version release of fetchmail is now available at the usual locations,
96 including <URL:http://$ENV{'WWWVIRTUAL'}/~esr/fetchmail> and 
97 <URL:ftp://ftp.ccil.org/pub/esr/fetchmail>.
98
99 Here are the release notes:
100
101 EOF
102
103 # Extract the current notes
104 open(NEWS, "NEWS");
105 while (<NEWS>) {
106     if (/^fetchmail/) {
107         print REPORT $_;
108         last;
109     }
110 }
111 while (<NEWS>) {
112     if (/^fetchmail/) {
113         last;
114     }
115     print REPORT $_;
116 }
117
118 $oldrcs = $oldid;
119 $oldrcs =~ tr/-/./;
120 print REPORT <<EOF;
121
122 By popular demand, diffs from the previous release have been omitted.
123 EOF
124 #Diffs from the previous ($oldrcs) release follow as a MIME attachment.
125
126 close(NEWS);
127
128 close(REPORT);
129
130 if ($rcsid eq '<workfile>') {
131     system("rcsdiff -u -r$oldid          RCS/* 2>/dev/null >DIFFS.$$");
132 } else {
133     system("rcsdiff -u -r$oldid -r$rcsid RCS/* 2>/dev/null >DIFFS.$$");
134 }
135
136 rename("PREAMBLE.$$", "RELEASE.NOTES");
137 system("chown esr RELEASE.NOTES");
138 chmod(0700, "RELEASE.NOTES");
139 # If we ever want to go back to enclosing diffs.
140 #system "metasend -b -D 'fetchmail-$rcsid announcement' -m 'text/plain' -e 7bit -f PREAMBLE.$$ -n -D 'diff -u between -$oldrcs $rcsid' -m 'text/plain' -e 7bit -f DIFFS.$$ -o RELEASE_NOTES";
141
142 unlink("PREAMBLE.$$");
143 unlink("DIFFS.$$");
144
145 print "Building index page...\n";
146 system("rm -f index.html; indexgen.sh");
147
148 print "Done\n";
149
150 # makerelease ends here