]> Pileus Git - ~andy/fetchmail/blob - makerelease
Send # to stdout.
[~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 = "-0500";
8
9 $diffs = 0;
10 $verbose = 0;
11 $null = ">/dev/null";
12 while ($i = shift @ARGV)
13 {
14         if ($i =~ /^(--diffs|-d)$/i)
15         {
16                 $diffs = 1;
17                 next;
18         }
19
20         if ($i =~ /^(--verbose|-v)$/i)
21         {
22                 $verbose = 1;
23                 $null = "";
24                 next;
25         }
26
27         die "Error: Unknown option: $i\n";
28 }
29
30
31 $version=`grep 'VERSION *=' Makefile.in`;
32 $version =~ /VERSION *= *(.*)/;
33 $version = $1;
34 $rcsid = $version;
35 $rcsid =~ tr/./-/;
36
37 open(ID, "rlog -h NEWS|");
38 while (<ID>) {
39     last if /^symbolic names/;
40 }
41 while (<ID>) {
42     if (/^\t(.*):/) {
43         push(@versions, $1);
44     }
45 }
46 close(ID);
47
48 if ($versions[0] eq $rcsid) {
49     $rcsid = $versions[0];
50     $oldid = $versions[1];
51 } else {
52     $rcsid = '<workfile>';
53     $oldid = $versions[0];
54 }
55
56 #$ENV{'PATH'} = "~esr/bin:/bin:/usr/bin";
57
58 print "Building $version release, RCS ID $rcsid, previous RCS ID $oldid\n";
59
60 print "### Test-building the software...\n";
61 if (system("su -c '(configure --disable-nls; make) $null' esr")) {
62         die("Compilation failure\n");
63 }
64
65 print "### Building the distribution...\n";
66 if (system("su -c 'make dist $null' esr")) {
67         die("Distribution-build failure\n");
68 }
69
70 print "### Building the RPMs...\n";
71 if (system("make rpm $null && chown esr *.rpm")) {
72         die("RPM-build failure\n");
73 }
74
75 open(REPORT, ">PREAMBLE.$$");
76
77 print REPORT <<EOF;
78 From: esr\@thyrsus.com (Eric S. Raymond)
79 To: fetchmail-friends\@ccil.org, fetchmail-announce\@ccil.org
80 Reply-To: esr\@thyrsus.com (Eric S. Raymond)
81 Subject: The $version release of fetchmail is available
82 FCC: ~/postings/outmail
83
84 The $version release of fetchmail is now available at the usual locations,
85 including <URL:http://$ENV{'WWWVIRTUAL'}/~esr/fetchmail>.
86
87 Here are the release notes:
88
89 EOF
90
91 # Extract the current notes
92 open(NEWS, "NEWS");
93 while (<NEWS>) {
94     if (/^fetchmail/) {
95         print REPORT $_;
96         last;
97     }
98 }
99 while (<NEWS>) {
100     if (/^fetchmail/) {
101         last;
102     }
103     print REPORT $_;
104 }
105
106 $oldrcs = $oldid;
107 $oldrcs =~ tr/-/./;
108
109 if ($diffs) {
110         print REPORT "Diffs from the previous ($oldrcs) release follow as a MIME attachment."
111 } else {
112         print REPORT "By popular demand, diffs from the previous release have been omitted."
113 }
114
115 close(NEWS);
116
117 close(REPORT);
118
119 if ($rcsid eq '<workfile>') {
120     system("rcsdiff -u -r$oldid          RCS/* 2>/dev/null >DIFFS.$$");
121 } else {
122     system("rcsdiff -u -r$oldid -r$rcsid RCS/* 2>/dev/null >DIFFS.$$");
123 }
124 print "Diff size:";
125 system("wc <DIFFS.$$");
126
127 if ($diffs) {
128         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";
129 } else {
130         rename("PREAMBLE.$$", "RELEASE.NOTES");
131 }
132 system("chown esr RELEASE.NOTES");
133 chmod(0700, "RELEASE.NOTES");
134
135 #unlink("PREAMBLE.$$");
136 unlink("DIFFS.$$");
137
138 print "Building index page...\n";
139 system("rm -f index.html; indexgen.sh");
140
141 print "Building test server list...\n";
142 system("rm -f testservers.html; testservers-gen.sh >testservers.html");
143
144 print "Making activity graph...";
145 growthplot;
146
147 print "Done\n";
148
149 # makerelease ends here