Commit 643a221914b2c816cb749b91d0a0ab0269dfd516

Authored by Jay Berkenbilt
1 parent 723b054b

Refine release process

Showing 2 changed files with 47 additions and 28 deletions
README-maintainer
@@ -40,7 +40,7 @@ RELEASE PREPARATION @@ -40,7 +40,7 @@ RELEASE PREPARATION
40 * Run a spelling checker over the source code to catch errors in 40 * Run a spelling checker over the source code to catch errors in
41 variable names, strings, and comments. 41 variable names, strings, and comments.
42 42
43 - ispell -p ispell-words **/*.hh **/*.cc manual/* 43 + ispell -p ispell-words **/*.hh **/*.cc manual/* ChangeLog
44 44
45 * If needed, run large file and image comparison tests. Configure 45 * If needed, run large file and image comparison tests. Configure
46 options: 46 options:
@@ -49,7 +49,8 @@ RELEASE PREPARATION @@ -49,7 +49,8 @@ RELEASE PREPARATION
49 49
50 For Windows, use a Windows style path, not an MSYS path for large files. 50 For Windows, use a Windows style path, not an MSYS path for large files.
51 51
52 -* Test with clang. Pass `CC=clang CXX=clang++` to `./configure`. 52 +* Test with clang. Pass `CC=clang CXX=clang++` to `./configure`. Test
  53 + with newer version of gcc if available.
53 54
54 * Test build on a mac. 55 * Test build on a mac.
55 56
@@ -114,14 +115,11 @@ CREATING A RELEASE @@ -114,14 +115,11 @@ CREATING A RELEASE
114 * Create source release: 115 * Create source release:
115 116
116 version=x.y.z 117 version=x.y.z
117 -\rm -rf /tmp/qpdf-$version  
118 -git archive --prefix=qpdf-$version/ HEAD . | (cd /tmp; tar xf -)  
119 -pushd /tmp  
120 -./qpdf-$version/make_dist  
121 -gpg --detach-sign --armor qpdf-$version.tar.gz  
122 -  
123 - Move qpdf-$version.tar.gz and qpdf-$version.tar.gz.asc to the  
124 - release archive area. 118 +./make_dist $version
  119 +gpg --detach-sign --armor /tmp/qpdf-$version.tar.gz
  120 +
  121 + Move /tmp/qpdf-$version.tar.gz and /tmp/qpdf-$version.tar.gz.asc to
  122 + the release archive area.
125 123
126 For iterating on the release during testing, pass `--no-tests` to 124 For iterating on the release during testing, pass `--no-tests` to
127 make_dist to skip the test suite. 125 make_dist to skip the test suite.
make_dist
@@ -11,28 +11,43 @@ use File::Basename; @@ -11,28 +11,43 @@ use File::Basename;
11 use Cwd; 11 use Cwd;
12 use Cwd 'abs_path'; 12 use Cwd 'abs_path';
13 use IO::File; 13 use IO::File;
  14 +use File::Path qw(rmtree);
14 15
15 my $whoami = basename($0); 16 my $whoami = basename($0);
16 -my $srcdir = basename(dirname($0));  
17 -my $pwd = getcwd();  
18 -usage() unless $pwd eq abs_path(dirname(dirname($0)));  
19 17
20 my $run_tests = 1; 18 my $run_tests = 1;
  19 +my $keep_tmp = 0;
  20 +my $version = undef;
21 foreach my $arg (@ARGV) 21 foreach my $arg (@ARGV)
22 { 22 {
23 if ($arg eq '--no-tests') 23 if ($arg eq '--no-tests')
24 { 24 {
25 $run_tests = 0; 25 $run_tests = 0;
26 } 26 }
  27 + elsif ($arg eq '--keep-tmp')
  28 + {
  29 + $keep_tmp = 1;
  30 + }
  31 + elsif (! defined $version)
  32 + {
  33 + $version = $arg;
  34 + }
27 else 35 else
28 { 36 {
29 usage(); 37 usage();
30 } 38 }
31 } 39 }
32 40
33 -usage() unless $srcdir =~ m/^qpdf-(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/;  
34 -my $version = $1;  
35 -cd($srcdir); 41 +usage() unless defined $version;
  42 +usage() unless $version =~ m/^(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/;
  43 +my $distname = "qpdf-$version";
  44 +my $tmpdir = "/tmp/$distname";
  45 +if ((-d $tmpdir) && (! $keep_tmp))
  46 +{
  47 + rmtree($tmpdir);
  48 +}
  49 +run("git archive --prefix=qpdf-$version/ HEAD . | (cd /tmp; tar xf -)");
  50 +cd($tmpdir);
36 51
37 # Check versions 52 # Check versions
38 my $fh = safe_open("configure.ac"); 53 my $fh = safe_open("configure.ac");
@@ -96,21 +111,25 @@ run("./autogen.sh"); @@ -96,21 +111,25 @@ run("./autogen.sh");
96 run("./configure --enable-doc-maintenance --enable-werror"); 111 run("./configure --enable-doc-maintenance --enable-werror");
97 run("make -j8 build_manual"); 112 run("make -j8 build_manual");
98 run("make distclean"); 113 run("make distclean");
99 -cd($pwd);  
100 -run("tar czvf $srcdir.tar.gz-candidate $srcdir"); 114 +cd("/tmp");
  115 +run("tar czvf $distname.tar.gz-candidate $distname");
101 if ($run_tests) 116 if ($run_tests)
102 { 117 {
103 - cd($srcdir); 118 + cd($tmpdir);
104 run("./configure"); 119 run("./configure");
105 run("make -j8"); 120 run("make -j8");
106 run("make check"); 121 run("make check");
107 - cd($pwd); 122 + cd("/tmp");
  123 +}
  124 +rename "$distname.tar.gz-candidate", "$distname.tar.gz" or die;
  125 +
  126 +if (! $keep_tmp)
  127 +{
  128 + rmtree($tmpdir);
108 } 129 }
109 -rename "$srcdir.tar.gz-candidate", "$srcdir.tar.gz" or die;  
110 130
111 print " 131 print "
112 -Source distribution created as $srcdir.tar.gz  
113 -You can now remove $srcdir. 132 +Source distribution created as $tmpdir.tar.gz
114 If this is a release, don't forget to tag the version control system and 133 If this is a release, don't forget to tag the version control system and
115 make a backup of the release tar file. 134 make a backup of the release tar file.
116 135
@@ -138,12 +157,14 @@ sub cd @@ -138,12 +157,14 @@ sub cd
138 sub usage 157 sub usage
139 { 158 {
140 die " 159 die "
141 -Usage: $whoami [ --no-tests ] 160 +Usage: $whoami [ --no-tests --keep-tmp ] version
  161 +
  162 +Use of --no-tests can be used for internally testing releases, but do
  163 +not use it for a real release.
142 164
143 -$whoami must be run from the parent of a directory called  
144 -qpdf-<version> which must contain a pristine export of that version of  
145 -qpdf from the version control system. Use of --no-tests can be used  
146 -for internally testing releases, but do not use it for a real release. 165 +$whoami creates /tmp/qpdf-<version> and deletes it when done. With
  166 +--keep-tmp, the directory is kept. This can be useful for debugging
  167 +the release process.
147 168
148 "; 169 ";
149 } 170 }