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