Commit 2cee5591f39dcc60b96af848b4a4f5683fc3d0b9

Authored by Jay Berkenbilt
1 parent 43740ea7

Avoid /tmp when building distribution

build-scripts/build-linux
@@ -14,7 +14,9 @@ for i in $(./qpdf/build/qpdf --show-crypto); do @@ -14,7 +14,9 @@ for i in $(./qpdf/build/qpdf --show-crypto); do
14 echo "*** Running tests with crypto provider $i" 14 echo "*** Running tests with crypto provider $i"
15 env QPDF_CRYPTO_PROVIDER=$i make -k check 15 env QPDF_CRYPTO_PROVIDER=$i make -k check
16 done 16 done
  17 +export TMPDIR=$PWD/dist-tmp
  18 +rm -rf $TMPDIR
17 ./make_dist --ci --no-tests 19 ./make_dist --ci --no-tests
18 mkdir distribution 20 mkdir distribution
19 -cp /tmp/qpdf*-ci.tar.gz distribution 21 +cp $TMPDIR/qpdf*-ci.tar.gz distribution
20 sha256sum distribution/* 22 sha256sum distribution/*
make_dist
@@ -11,10 +11,11 @@ use File::Basename; @@ -11,10 +11,11 @@ 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 +use File::Path qw(rmtree make_path);
15 15
16 my $whoami = basename($0); 16 my $whoami = basename($0);
17 17
  18 +my $tmp = $ENV{'TMPDIR'} || '/tmp';
18 my $run_tests = 1; 19 my $run_tests = 1;
19 my $keep_tmp = 0; 20 my $keep_tmp = 0;
20 my $ci_mode = 0; 21 my $ci_mode = 0;
@@ -51,12 +52,13 @@ if ($ci_mode && (! defined $version)) @@ -51,12 +52,13 @@ if ($ci_mode && (! defined $version))
51 usage() unless defined $version; 52 usage() unless defined $version;
52 usage() unless $version =~ m/^(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/; 53 usage() unless $version =~ m/^(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/;
53 my $distname = "qpdf-$version"; 54 my $distname = "qpdf-$version";
54 -my $tmpdir = "/tmp/$distname"; 55 +my $tmpdir = "${tmp}/$distname";
55 if ((-d $tmpdir) && (! $keep_tmp)) 56 if ((-d $tmpdir) && (! $keep_tmp))
56 { 57 {
57 rmtree($tmpdir); 58 rmtree($tmpdir);
58 } 59 }
59 -run("git archive --prefix=qpdf-$version/ HEAD . | (cd /tmp; tar xf -)"); 60 +make_path($tmp);
  61 +run("git archive --prefix=qpdf-$version/ HEAD . | (cd $tmp; tar xf -)");
60 cd($tmpdir); 62 cd($tmpdir);
61 63
62 # Check versions 64 # Check versions
@@ -94,7 +96,7 @@ if ($version_error) @@ -94,7 +96,7 @@ if ($version_error)
94 run("./configure --disable-shared --enable-doc-maintenance --enable-werror"); 96 run("./configure --disable-shared --enable-doc-maintenance --enable-werror");
95 run("make -j8 build_manual"); 97 run("make -j8 build_manual");
96 run("make distclean"); 98 run("make distclean");
97 -cd("/tmp"); 99 +cd($tmp);
98 run("tar czvf $distname.tar.gz-candidate $distname"); 100 run("tar czvf $distname.tar.gz-candidate $distname");
99 if ($run_tests) 101 if ($run_tests)
100 { 102 {
@@ -102,7 +104,7 @@ if ($run_tests) @@ -102,7 +104,7 @@ if ($run_tests)
102 run("./configure"); 104 run("./configure");
103 run("make -j8"); 105 run("make -j8");
104 run("make check"); 106 run("make check");
105 - cd("/tmp"); 107 + cd($tmp);
106 } 108 }
107 my $distfile = ($ci_mode ? "$distname-ci.tar.gz" : "$distname.tar.gz"); 109 my $distfile = ($ci_mode ? "$distname-ci.tar.gz" : "$distname.tar.gz");
108 rename "$distname.tar.gz-candidate", $distfile or die; 110 rename "$distname.tar.gz-candidate", $distfile or die;
@@ -113,7 +115,7 @@ if (! $keep_tmp) @@ -113,7 +115,7 @@ if (! $keep_tmp)
113 } 115 }
114 116
115 print " 117 print "
116 -Source distribution created as /tmp/$distfile 118 +Source distribution created as ${tmp}/$distfile
117 If this is a release, don't forget to tag the version control system and 119 If this is a release, don't forget to tag the version control system and
118 make a backup of the release tar file. 120 make a backup of the release tar file.
119 121
@@ -210,7 +212,7 @@ Usage: $whoami [ --no-tests --keep-tmp ] version @@ -210,7 +212,7 @@ Usage: $whoami [ --no-tests --keep-tmp ] version
210 Use of --no-tests can be used for internally testing releases, but do 212 Use of --no-tests can be used for internally testing releases, but do
211 not use it for a real release. 213 not use it for a real release.
212 214
213 -$whoami creates /tmp/qpdf-<version> and deletes it when done. With 215 +$whoami creates ${tmp}/qpdf-<version> and deletes it when done. With
214 --keep-tmp, the directory is kept. This can be useful for debugging 216 --keep-tmp, the directory is kept. This can be useful for debugging
215 the release process. 217 the release process.
216 218