#!/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 = "-0500"; 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], substr("0$mday", -2) . $months[$mon] " . " $timezone " . substr("0$hour", -2) . ":" . substr("0$min", -2) . ":" . substr("0$sec", -2) . " " . (1900+$year); } $version=`grep 'VERSION *=' Makefile.in`; $version =~ /VERSION *= *(.*)/; $version = $1; $rcsid = $version; $rcsid =~ tr/./-/; open(ID, "rlog -h NEWS|"); while () { last if /^symbolic names/; } while () { if (/^\t(.*):/) { push(@versions, $1); } } close(ID); if ($versions[0] eq $rcsid) { $rcsid = $versions[0]; $oldid = $versions[1]; } else { $rcsid = ''; $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 = ; 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, "mkr$$.tmp") || die("Error opening temp file\n"); print TMP < ${date} EOF while () { print TMP $_; } close(TMP); close(DEBLOG); system("mv mkr$$.tmp debian/changelog"); } 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 < and . Here are the release notes: EOF # Extract the current notes open(NEWS, "NEWS"); while () { if (/^fetchmail/) { print REPORT $_; last; } } while () { if (/^fetchmail/) { last; } print REPORT $_; } $oldrcs = $oldid; $oldrcs =~ tr/-/./; print REPORT <') { 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