diff options
author | Simon Tatham <anakin@pobox.com> | 2015-11-07 18:59:00 +0300 |
---|---|---|
committer | Simon Tatham <anakin@pobox.com> | 2015-11-07 19:14:28 +0300 |
commit | f3230c85457cc3d13c46e8ea91c9748dcd0054af (patch) | |
tree | 27cc2d6c6370331653c3fece9f446acf14a6d924 /release.pl | |
parent | 3552f37ba5eab32247e44af96fa7a41994268159 (diff) |
More post-release checklist updates, and a new script.
I've added a few sample shell commands in the upload procedure (mostly
so that I don't have to faff about remembering how rsync trailing
slashes work every time), and also written a script called
'release.pl', which automates the updating of the version number in
all the various places it needs to be done and also ensures the PSCP
and Plink transcripts in the docs will match the release itself.
Diffstat (limited to 'release.pl')
-rwxr-xr-x | release.pl | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/release.pl b/release.pl new file mode 100755 index 00000000..27e0f8c3 --- /dev/null +++ b/release.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +# Script to automate some easy-to-mess-up parts of the PuTTY release +# procedure. + +use strict; +use warnings; +use Getopt::Long; +use File::Temp qw/tempdir/; + +my $version = undef; +GetOptions("set-version=s" => \$version) + or &usage(); + +if (defined $version) { + 0 == system "git", "diff-index", "--quiet", "--cached", "HEAD" + or die "index is dirty"; + 0 == system "git", "diff-files", "--quiet" or die "working tree is dirty"; + -f "Makefile" and die "run 'make distclean' first"; + my $builddir = tempdir(DIR => ".", CLEANUP => 1); + 0 == system "./mkfiles.pl" or die; + 0 == system "cd $builddir && ../configure" or die; + 0 == system "cd $builddir && make pscp plink RELEASE=${version}" or die; + our $pscp_transcript = `cd $builddir && ./pscp --help`; + $pscp_transcript =~ s/^Unidentified build/Release ${version}/m or die; + $pscp_transcript =~ s/^/\\c /mg; + our $plink_transcript = `cd $builddir && ./plink --help`; + $plink_transcript =~ s/^Unidentified build/Release ${version}/m or die; + $plink_transcript =~ s/^/\\c /mg; + &transform("LATEST.VER", sub { s/^\d+\.\d+$/$version/ }); + &transform("windows/putty.iss", sub { + s/^(AppVerName=PuTTY version |VersionInfoTextVersion=Release |AppVersion=|VersionInfoVersion=)\d+\.\d+/$1$version/ }); + our $transforming = 0; + &transform("doc/pscp.but", sub { + if (/^\\c.*>pscp$/) { $transforming = 1; $_ .= $pscp_transcript; } + elsif (!/^\\c/) { $transforming = 0; } + elsif ($transforming) { $_=""; } + }); + $transforming = 0; + &transform("doc/plink.but", sub { + if (/^\\c.*>plink$/) { $transforming = 1; $_ .= $plink_transcript; } + elsif (!/^\\c/) { $transforming = 0; } + elsif ($transforming) { $_=""; } + }); + &transform("Buildscr", sub { + s!^(set Epoch )\d+!$1 . sprintf "%d", time/86400 - 1000!e }); + 0 == system ("git", "commit", "-a", "-m", + "Update version number for ${version} release.") or die; + exit 0; +} + +&usage(); + +sub transform { + my ($filename, $proc) = @_; + my $file; + open $file, "<", $filename or die "$file: open for read: $!\n"; + my $data = ""; + while (<$file>) { + $proc->(); + $data .= $_; + } + close $file; + open $file, ">", $filename or die "$file: open for write: $!\n"; + print $file $data; + close $file or die "$file: close after write: $!\n";; +} + +sub usage { + die "usage: release.pl --set-version=X.YZ\n"; +} |