]> Pileus Git - ~andy/fetchmail/blob - makerelease
Add GPL license.
[~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 The source archive is available at:
88 <URL:http://$ENV{'WWWVIRTUAL'}/~esr/fetchmail/fetchmail-${version}.tar.gz>
89
90 Here are the release notes:
91
92 EOF
93
94 # Extract the current notes
95 open(NEWS, "NEWS");
96 while (<NEWS>) {
97     if (/^fetchmail/) {
98         print REPORT $_;
99         last;
100     }
101 }
102 while (<NEWS>) {
103     if (/^fetchmail/) {
104         last;
105     }
106     print REPORT $_;
107 }
108
109 $oldrcs = $oldid;
110 $oldrcs =~ tr/-/./;
111
112 if ($diffs) {
113         print REPORT "Diffs from the previous ($oldrcs) release follow as a MIME attachment."
114 } else {
115         print REPORT "By popular demand, diffs from the previous release have been omitted."
116 }
117
118 close(NEWS);
119
120 close(REPORT);
121
122 if ($rcsid eq '<workfile>') {
123     system("rcsdiff -u -r$oldid          RCS/* 2>/dev/null >DIFFS.$$");
124 } else {
125     system("rcsdiff -u -r$oldid -r$rcsid RCS/* 2>/dev/null >DIFFS.$$");
126 }
127 print "Diff size:";
128 system("wc <DIFFS.$$");
129
130 if ($diffs) {
131         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";
132 } else {
133         rename("PREAMBLE.$$", "RELEASE.NOTES");
134 }
135 system("chown esr RELEASE.NOTES");
136 chmod(0700, "RELEASE.NOTES");
137
138 #unlink("PREAMBLE.$$");
139 unlink("DIFFS.$$");
140
141 print "Building index page...\n";
142 system("rm -f index.html; indexgen.sh");
143
144 print "Building test server list...\n";
145 system("rm -f testservers.html; testservers-gen.sh >testservers.html");
146
147 print "Making activity graph...";
148 growthplot;
149
150 print "Done\n";
151
152 # makerelease ends here