3 # Make a fetchmail release.
4 # Dumps a release notice and diffs as a MIME multipart message
7 use POSIX qw(strftime);
8 $tmp = $ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp";
10 die "This script ($0) needs to be updated for the Git-orious repo.";
12 $project = "fetchmail";
13 $svnrepos = "http://mknod.org/svn/$project";
14 $website = "http://developer.berlios.de/projects/$project";
15 $mailfrom = "<$project-devel-owner\@lists.berlios.de> (Fetchmail Development Team)";
17 die "Need GNU sort!" unless `sort --version | head -n1` =~ /GNU/;
23 $errnull = "2>/dev/null";
24 while ($i = shift @ARGV)
26 if ($i =~ /^(--diffs|-d)$/i)
32 if ($i =~ /^(--verbose|-v)$/i)
39 die "Error: Unknown option: $i\n";
42 # extract version from source
43 $version=`grep 'AC_INIT' configure.ac`;
44 $version =~ /AC_INIT\([^,]*,\[?([0-9.rc-]+)\]?\,.*\)/;
46 die "cannot determine version" unless defined $1;
47 $tag = "RELEASE_$version";
50 # extract existing tags
51 open(ID, "svn ls \"$svnrepos/tags\" | sort -t- -k1,1 -k2,2n -k3,3n |") || die "cannot run svn ls: $!\naborting";
53 if (m{^(RELEASE_.*)/}) {
54 unshift(@versions, $1);
57 close ID || die "svn ls failed, aborting";
59 if ($versions[0] eq $tag) {
61 $oldtag = $versions[1];
64 $oldtag = $versions[0];
67 $pwd = `pwd`; chomp $pwd;
69 $ENV{PATH} .= ":$pwd/dist-tools:$pwd/dist-tools/shipper";
71 print "Building $version release, tag $tag, previous tag $oldtag\n";
73 if (-d "autom4te.cache") {
74 system("rm -rf autom4te.cache")
75 and die "Failure in removing autom4te.cache";
78 if (system("autoreconf -isv")) {
79 die("Failure in regenerating autoconf files\n");
82 print "### Test-building the software...\n";
83 if (system("mkdir -p autobuild && cd autobuild && ../configure -C --silent && make -s clean && make check distcheck")) {
84 die("Compilation failure\n");
87 # print "### Building the RPMs...\n";
88 # if (system("cd autobuild && cp ../fetchmail.xpm . && buildrpms $project-${version}.tar.bz2 $null")) {
89 # die("RPM-build failure\n");
92 open(REPORT, ">$tmp/$project.PREAMBLE.$$");
96 Subject: The $version release of $project is available
98 The $version release of $project is now available at the usual locations,
101 The source archive is available at:
102 <$website/$project-${version}.tar.gz>
104 Here are the release notes:
108 # Extract the current notes
125 $oldver =~ s/^RELEASE_//;
128 print REPORT "Diffs from the previous ($oldver) release follow as a MIME attachment."
130 print REPORT "By popular demand, diffs from the previous release have been omitted."
137 if ($tag eq '<workfile>') {
138 system("svn diff -r$oldtag $errnull >$tmp/$project.DIFFS.$$");
140 system("svn diff -r$oldtag -r$tag $errnull >$tmp/$project.DIFFS.$$");
143 system("wc <$tmp/$project.DIFFS.$$");
147 ." -D '$project-$tag announcement' -m 'text/plain' -e 7bit -f $tmp/$project.PREAMBLE.$$"
148 ." -n -D 'diff between $oldver and $version' -m 'text/plain' -e 7bit -f $tmp/$project.DIFFS.$$"
149 ." -o ANNOUNCE.EMAIL";
151 system("mv", "$tmp/$project.PREAMBLE.$$", "ANNOUNCE.EMAIL");
154 #unlink("$tmp/$project.PREAMBLE.$$");
155 unlink("$tmp/$project.DIFFS.$$");
159 # makerelease ends here