From 643a221914b2c816cb749b91d0a0ab0269dfd516 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 16 Aug 2018 11:20:35 -0400 Subject: [PATCH] Refine release process --- README-maintainer | 16 ++++++------- make_dist | 57 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/README-maintainer b/README-maintainer index 7bc7e7c2..69f5116b 100644 --- a/README-maintainer +++ b/README-maintainer @@ -40,7 +40,7 @@ RELEASE PREPARATION * Run a spelling checker over the source code to catch errors in variable names, strings, and comments. - ispell -p ispell-words **/*.hh **/*.cc manual/* + ispell -p ispell-words **/*.hh **/*.cc manual/* ChangeLog * If needed, run large file and image comparison tests. Configure options: @@ -49,7 +49,8 @@ RELEASE PREPARATION For Windows, use a Windows style path, not an MSYS path for large files. -* Test with clang. Pass `CC=clang CXX=clang++` to `./configure`. +* Test with clang. Pass `CC=clang CXX=clang++` to `./configure`. Test + with newer version of gcc if available. * Test build on a mac. @@ -114,14 +115,11 @@ CREATING A RELEASE * Create source release: version=x.y.z -\rm -rf /tmp/qpdf-$version -git archive --prefix=qpdf-$version/ HEAD . | (cd /tmp; tar xf -) -pushd /tmp -./qpdf-$version/make_dist -gpg --detach-sign --armor qpdf-$version.tar.gz +./make_dist $version +gpg --detach-sign --armor /tmp/qpdf-$version.tar.gz - Move qpdf-$version.tar.gz and qpdf-$version.tar.gz.asc to the - release archive area. + Move /tmp/qpdf-$version.tar.gz and /tmp/qpdf-$version.tar.gz.asc to + the release archive area. For iterating on the release during testing, pass `--no-tests` to make_dist to skip the test suite. diff --git a/make_dist b/make_dist index eff0d81c..9084bdb1 100755 --- a/make_dist +++ b/make_dist @@ -11,28 +11,43 @@ use File::Basename; use Cwd; use Cwd 'abs_path'; use IO::File; +use File::Path qw(rmtree); my $whoami = basename($0); -my $srcdir = basename(dirname($0)); -my $pwd = getcwd(); -usage() unless $pwd eq abs_path(dirname(dirname($0))); my $run_tests = 1; +my $keep_tmp = 0; +my $version = undef; foreach my $arg (@ARGV) { if ($arg eq '--no-tests') { $run_tests = 0; } + elsif ($arg eq '--keep-tmp') + { + $keep_tmp = 1; + } + elsif (! defined $version) + { + $version = $arg; + } else { usage(); } } -usage() unless $srcdir =~ m/^qpdf-(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/; -my $version = $1; -cd($srcdir); +usage() unless defined $version; +usage() unless $version =~ m/^(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/; +my $distname = "qpdf-$version"; +my $tmpdir = "/tmp/$distname"; +if ((-d $tmpdir) && (! $keep_tmp)) +{ + rmtree($tmpdir); +} +run("git archive --prefix=qpdf-$version/ HEAD . | (cd /tmp; tar xf -)"); +cd($tmpdir); # Check versions my $fh = safe_open("configure.ac"); @@ -96,21 +111,25 @@ run("./autogen.sh"); run("./configure --enable-doc-maintenance --enable-werror"); run("make -j8 build_manual"); run("make distclean"); -cd($pwd); -run("tar czvf $srcdir.tar.gz-candidate $srcdir"); +cd("/tmp"); +run("tar czvf $distname.tar.gz-candidate $distname"); if ($run_tests) { - cd($srcdir); + cd($tmpdir); run("./configure"); run("make -j8"); run("make check"); - cd($pwd); + cd("/tmp"); +} +rename "$distname.tar.gz-candidate", "$distname.tar.gz" or die; + +if (! $keep_tmp) +{ + rmtree($tmpdir); } -rename "$srcdir.tar.gz-candidate", "$srcdir.tar.gz" or die; print " -Source distribution created as $srcdir.tar.gz -You can now remove $srcdir. +Source distribution created as $tmpdir.tar.gz If this is a release, don't forget to tag the version control system and make a backup of the release tar file. @@ -138,12 +157,14 @@ sub cd sub usage { die " -Usage: $whoami [ --no-tests ] +Usage: $whoami [ --no-tests --keep-tmp ] version -$whoami must be run from the parent of a directory called -qpdf- which must contain a pristine export of that version of -qpdf from the version control system. Use of --no-tests can be used -for internally testing releases, but do not use it for a real release. +Use of --no-tests can be used for internally testing releases, but do +not use it for a real release. + +$whoami creates /tmp/qpdf- and deletes it when done. With +--keep-tmp, the directory is kept. This can be useful for debugging +the release process. "; }