2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-01 01:40:51 +00:00

Avoid /tmp when building distribution

This commit is contained in:
Jay Berkenbilt 2021-12-13 07:43:26 -05:00
parent 43740ea733
commit 2cee5591f3
2 changed files with 12 additions and 8 deletions

View File

@ -14,7 +14,9 @@ for i in $(./qpdf/build/qpdf --show-crypto); do
echo "*** Running tests with crypto provider $i" echo "*** Running tests with crypto provider $i"
env QPDF_CRYPTO_PROVIDER=$i make -k check env QPDF_CRYPTO_PROVIDER=$i make -k check
done done
export TMPDIR=$PWD/dist-tmp
rm -rf $TMPDIR
./make_dist --ci --no-tests ./make_dist --ci --no-tests
mkdir distribution mkdir distribution
cp /tmp/qpdf*-ci.tar.gz distribution cp $TMPDIR/qpdf*-ci.tar.gz distribution
sha256sum distribution/* sha256sum distribution/*

View File

@ -11,10 +11,11 @@ use File::Basename;
use Cwd; use Cwd;
use Cwd 'abs_path'; use Cwd 'abs_path';
use IO::File; use IO::File;
use File::Path qw(rmtree); use File::Path qw(rmtree make_path);
my $whoami = basename($0); my $whoami = basename($0);
my $tmp = $ENV{'TMPDIR'} || '/tmp';
my $run_tests = 1; my $run_tests = 1;
my $keep_tmp = 0; my $keep_tmp = 0;
my $ci_mode = 0; my $ci_mode = 0;
@ -51,12 +52,13 @@ if ($ci_mode && (! defined $version))
usage() unless defined $version; usage() unless defined $version;
usage() unless $version =~ m/^(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/; usage() unless $version =~ m/^(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/;
my $distname = "qpdf-$version"; my $distname = "qpdf-$version";
my $tmpdir = "/tmp/$distname"; my $tmpdir = "${tmp}/$distname";
if ((-d $tmpdir) && (! $keep_tmp)) if ((-d $tmpdir) && (! $keep_tmp))
{ {
rmtree($tmpdir); rmtree($tmpdir);
} }
run("git archive --prefix=qpdf-$version/ HEAD . | (cd /tmp; tar xf -)"); make_path($tmp);
run("git archive --prefix=qpdf-$version/ HEAD . | (cd $tmp; tar xf -)");
cd($tmpdir); cd($tmpdir);
# Check versions # Check versions
@ -94,7 +96,7 @@ if ($version_error)
run("./configure --disable-shared --enable-doc-maintenance --enable-werror"); run("./configure --disable-shared --enable-doc-maintenance --enable-werror");
run("make -j8 build_manual"); run("make -j8 build_manual");
run("make distclean"); run("make distclean");
cd("/tmp"); cd($tmp);
run("tar czvf $distname.tar.gz-candidate $distname"); run("tar czvf $distname.tar.gz-candidate $distname");
if ($run_tests) if ($run_tests)
{ {
@ -102,7 +104,7 @@ if ($run_tests)
run("./configure"); run("./configure");
run("make -j8"); run("make -j8");
run("make check"); run("make check");
cd("/tmp"); cd($tmp);
} }
my $distfile = ($ci_mode ? "$distname-ci.tar.gz" : "$distname.tar.gz"); my $distfile = ($ci_mode ? "$distname-ci.tar.gz" : "$distname.tar.gz");
rename "$distname.tar.gz-candidate", $distfile or die; rename "$distname.tar.gz-candidate", $distfile or die;
@ -113,7 +115,7 @@ if (! $keep_tmp)
} }
print " print "
Source distribution created as /tmp/$distfile Source distribution created as ${tmp}/$distfile
If this is a release, don't forget to tag the version control system and If this is a release, don't forget to tag the version control system and
make a backup of the release tar file. make a backup of the release tar file.
@ -210,7 +212,7 @@ Usage: $whoami [ --no-tests --keep-tmp ] version
Use of --no-tests can be used for internally testing releases, but do Use of --no-tests can be used for internally testing releases, but do
not use it for a real release. not use it for a real release.
$whoami creates /tmp/qpdf-<version> and deletes it when done. With $whoami creates ${tmp}/qpdf-<version> and deletes it when done. With
--keep-tmp, the directory is kept. This can be useful for debugging --keep-tmp, the directory is kept. This can be useful for debugging
the release process. the release process.