piuparts_wrapper: support setting tmpdir directory

By setting PIUPARTS_TMPDIR it's possible to control the place
where temporary files and directories are created by piuparts.
This allows pointing PIUPARTS_TMPDIR to a directory inside tmpfs
and therefore speeding up the build process.

Usage example, assuming /var/cache/pbuilder/ is a tmpfs:

  PIUPARTS_BUILDDIR="$(sudo mktemp -d --tmpdir=/var/cache/pbuilder/ --suffix=_piuparts_tmp)"

NOTE: Setting TMPDIR as an alternative (as documented by the
piuparts manpage) isn't recommended. The variable leaks into the
piuparts environment and several tools requiring a valid TMPDIR
fail then because the TMPDIR set from outside doesn't necessarily
exist within the piuparts chroot.

Development sponsored by Sipwise GmbH, recorded as
MT#9683 in customers' ticket system.
remotes/origin/mika/pr125
Michael Prokop 10 years ago
parent 3498d6c493
commit b52fc1a56e

@ -38,6 +38,11 @@ else
fi
fi
if [ -n "${PIUPARTS_TMPDIR:-}" ] ; then
echo "*** PIUPARTS_TMPDIR is set to $PIUPARTS_TMPDIR - using for piuparts run ***"
piuparts_tmpdir="$PIUPARTS_TMPDIR"
fi
create_base_tgz() {
[ -r /var/cache/pbuilder/base-${distribution}-${architecture}.tgz ] && return 0
@ -115,5 +120,6 @@ piuparts \
${skip_logrotatefiles_test_option:-} \
--log-file='piuparts.txt' \
${scriptsdir:+--scriptsdir "$scriptsdir"} \
${piuparts_tmpdir:+--tmpdir="$piuparts_tmpdir"} \
${basetgz:-} \
"$@"

Loading…
Cancel
Save