]> Pileus Git - ~andy/fetchmail/blob - makerelease
a88ade577d17ff9d2c1e72e140231f95cfe27569
[~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 if (system("./configure; make -C po update-po; make clean")) {
61         die("Failure in translation-file rebuild.")
62 }
63
64 print "### Test-building the software...\n";
65 if (system("configure --disable-nls; make")) {
66         die("Compilation failure\n");
67 }
68
69 print "### Building the distribution...\n";
70 if (system("make dist $null")) {
71         die("Distribution-build failure\n");
72 }
73
74 print "### Building the RPMs...\n";
75 if (system("make rpm $null && chown esr *.rpm")) {
76         die("RPM-build failure\n");
77 }
78
79 # Clean up permissions so next build won't foo up.
80 system("chown esr config.log stamp-h po/Makefile");
81
82 open(REPORT, ">PREAMBLE.$$");
83
84 print REPORT <<EOF;
85 From: esr\@thyrsus.com (Eric S. Raymond)
86 To: fetchmail-friends\@ccil.org, fetchmail-announce\@ccil.org
87 Reply-To: esr\@thyrsus.com (Eric S. Raymond)
88 Subject: The $version release of fetchmail is available
89 FCC: ~/postings/outmail
90
91 The $version release of fetchmail is now available at the usual locations,
92 including <URL:http://$ENV{'WWWVIRTUAL'}/~esr/fetchmail>.
93
94 The source archive is available at:
95 <URL:http://$ENV{'WWWVIRTUAL'}/~esr/fetchmail/fetchmail-${version}.tar.gz>
96
97 Here are the release notes:
98
99 EOF
100
101 # Extract the current notes
102 open(NEWS, "NEWS");
103 while (<NEWS>) {
104     if (/^fetchmail/) {
105         print REPORT $_;
106         last;
107     }
108 }
109 while (<NEWS>) {
110     if (/^fetchmail/) {
111         last;
112     }
113     print REPORT $_;
114 }
115
116 $oldrcs = $oldid;
117 $oldrcs =~ tr/-/./;
118
119 if ($diffs) {
120         print REPORT "Diffs from the previous ($oldrcs) release follow as a MIME attachment."
121 } else {
122         print REPORT "By popular demand, diffs from the previous release have been omitted."
123 }
124
125 close(NEWS);
126
127 close(REPORT);
128
129 if ($rcsid eq '<workfile>') {
130     system("rcsdiff -u -r$oldid          RCS/* 2>/dev/null >DIFFS.$$");
131 } else {
132     system("rcsdiff -u -r$oldid -r$rcsid RCS/* 2>/dev/null >DIFFS.$$");
133 }
134 print "Diff size:";
135 system("wc <DIFFS.$$");
136
137 if ($diffs) {
138         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";
139 } else {
140         rename("PREAMBLE.$$", "RELEASE.NOTES");
141 }
142 system("chown esr RELEASE.NOTES");
143 chmod(0700, "RELEASE.NOTES");
144
145 #unlink("PREAMBLE.$$");
146 unlink("DIFFS.$$");
147
148 print "Building index page...\n";
149 system("rm -f index.html; indexgen.sh");
150
151 print "Building test server list...\n";
152 system("rm -f testservers.html; testservers-gen.sh >testservers.html");
153
154 print "Making activity graph...";
155 growthplot;
156
157 print "Making LSM...";
158 $keywords="mail, client, POP, POP2, POP3, APOP, RPOP, KPOP, IMAP, ETRN, ODMR, SMTP, ESMTP, GSSAPI, RPA, NTLM, CRAM-MD5, SASL";
159 system("rpm2lsm -k '$keywords' fetchmail-$version-1.i386.rpm >fetchmail.lsm");
160 system("ls -l fetchmail.lsm");
161
162 # Avoid leaving unwriteable files around
163 system("chown -R esr .");
164
165 print "Done\n";
166
167 # makerelease ends here