aboutsummaryrefslogtreecommitdiffstats
path: root/makerelease
blob: b3644b6a2c2e4f28a80ccc8fbae6a1c813f33203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/perl
#
# Make a fetchmail release.  Must be run as root, to make RPMs.
# Dumps a release notice and diffs as a MIME multipart message 
# in RELEASE_NOTES
#
$timezone = "EDT";

sub rfc822date
{
    @wdays  = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
    @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Nov", "Dec");

    my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
    "$wdays[$wday] $months[$mon] " . substr("0$mday", -2) . " " . substr("0$hour", -2) . ":" . substr("0$min", -2) . ":" . substr("0$sec", -2) . " $timezone " . (1900+$year);
}


$version=`grep 'VERSION *=' Makefile.in`;
$version =~ /VERSION *= *(.*)/;
$version = $1;
$rcsid = $version;
$rcsid =~ tr/./-/;

open(ID, "rlog -h NEWS|");
while (<ID>) {
    last if /^symbolic names/;
}
while (<ID>) {
    if (/^\t(.*):/) {
	push(@versions, $1);
    }
}
close(ID);

if ($versions[0] eq $rcsid) {
    $rcsid = $versions[0];
    $oldid = $versions[1];
} else {
    $rcsid = '<workfile>';
    $oldid = $versions[0];
}

#$ENV{'PATH'} = "~esr/bin:/bin:/usr/bin";

print "Building $version release, RCS ID $rcsid, previous RCS ID $oldid\n";

print "Test-building the software...\n";
if (system("su -c 'make >/dev/null' esr")) {
	die("Compilation failure\n");
}

# Update the Debian logfile
open(DEBLOG, "debian/changelog");
$firstline = <DEBLOG>;
close(DEBLOG);
$firstline =~ /fetchmail \(*([^-]*)/;
$logvers = $1;
if ($version eq $logvers) {
    print "No change to Debian logfile...\n";
} else {
    $date = &rfc822date();
    print "Updating the Debian logfile ($logvers -> $version)...\n";
    open(DEBLOG, ">>debian/changelog");
    print DEBLOG <<EOF;
fetchmail (${version}-1) unstable; urgency=low

  * new upstream version
  
-- Eric S. Raymond <esr\@thyrsus.com>  ${date}
  
EOF
    close(DEBLOG);
}

print "Building the distribution...\n";
if (system("su -c 'make dist >/dev/null' esr")) {
	die("Distribution-build failure\n");
}

print "Building the RPMs...\n";
if (system("make rpm >/dev/null 2>/dev/null && chown esr *.rpm")) {
	die("RPM-build failure\n");
}

open(REPORT, ">PREAMBLE.$$");

print REPORT <<EOF;
From: esr\@thyrsus.com (Eric S. Raymond)
To: fetchmail-announce\@ccil.org
Reply-To: esr\@thyrsus.com (Eric S. Raymond)
Subject: The $version release of fetchmail is available
FCC: ~/postings/outmail

The $version release of fetchmail is now available at the usual locations,
including <URL:http://$ENV{'WWWVIRTUAL'}/~esr/fetchmail> and 
<URL:ftp://ftp.ccil.org/pub/esr/fetchmail>.

Here are the release notes:

EOF

# Extract the current notes
open(NEWS, "NEWS");
while (<NEWS>) {
    if (/^fetchmail/) {
	print REPORT $_;
	last;
    }
}
while (<NEWS>) {
    if (/^fetchmail/) {
	last;
    }
    print REPORT $_;
}

$oldrcs = $oldid;
$oldrcs =~ tr/-/./;
print REPORT <<EOF;

By popular demand, diffs from the previous release have been omitted.
EOF
#Diffs from the previous ($oldrcs) release follow as a MIME attachment.

close(NEWS);

close(REPORT);

if ($rcsid eq '<workfile>') {
    system("rcsdiff -u -r$oldid          RCS/* 2>/dev/null >DIFFS.$$");
} else {
    system("rcsdiff -u -r$oldid -r$rcsid RCS/* 2>/dev/null >DIFFS.$$");
}

rename("PREAMBLE.$$", "RELEASE.NOTES");
system("chown esr RELEASE.NOTES");
chmod(0700, "RELEASE.NOTES");
# If we ever want to go back to enclosing diffs.
#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";

unlink("PREAMBLE.$$");
unlink("DIFFS.$$");

print "Building index page...\n";
system("rm -f index.html; indexgen.sh");

print "Done\n";

# makerelease ends here