build-support: Fix nix-prefetch-* on OS X.

Fixes a regression on OS X introduced by f83af95.

Don't use --tmpdir for mktemp, because that flag doesn't exist on OS X.
However, using -t is deprecated in GNU coreutils, so as suggested by
@ip1981 we're now using parameter expansion on ${TMPDIR:-/tmp} to
provide /tmp as a fallback if TMPDIR is not set and use it instead.

Also use this approach for nix-prefetch-cvs now in order to stay
consistent.

Reported-by: Vladimir Kirillov <proger@wilab.org.ua>
Tested-by: Igor Pashev <pashev.igor@gmail.com>
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-08-27 10:48:26 +02:00
parent df30066790
commit 5e7a1cf955
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961
5 changed files with 5 additions and 5 deletions

View file

@ -43,7 +43,7 @@ fi
# If we don't know the hash or a path with that hash doesn't exist,
# download the file and add it to the store.
if test -z "$finalPath"; then
tmpPath="$(mktemp --tmpdir -d bzr-checkout-tmp-XXXXXXXX)"
tmpPath="$(mktemp -d "${TMPDIR:-/tmp}/bzr-checkout-tmp-XXXXXXXX")"
trap "rm -rf \"$tmpPath\"" EXIT
tmpFile="$tmpPath/$dstFile"

View file

@ -20,7 +20,7 @@ fi
mkTempDir() {
tmpPath=$(mktemp -d -t nix-prefetch-cvs-XXXXXXXX)
tmpPath="$(mktemp -d "${TMPDIR:-/tmp}/nix-prefetch-cvs-XXXXXXXX")"
trap removeTempDir EXIT SIGINT SIGQUIT
}

View file

@ -256,7 +256,7 @@ else
# download the file and add it to the store.
if test -z "$finalPath"; then
tmpPath="$(mktemp --tmpdir -d git-checkout-tmp-XXXXXXXX)"
tmpPath="$(mktemp -d "${TMPDIR:-/tmp}/git-checkout-tmp-XXXXXXXX")"
trap "rm -rf \"$tmpPath\"" EXIT
tmpFile="$tmpPath/git-export"

View file

@ -35,7 +35,7 @@ fi
# download the file and add it to the store.
if test -z "$finalPath"; then
tmpPath="$(mktemp --tmpdir -d hg-checkout-tmp-XXXXXXXX)"
tmpPath="$(mktemp -d "${TMPDIR:-/tmp}/hg-checkout-tmp-XXXXXXXX")"
trap "rm -rf \"$tmpPath\"" EXIT
tmpArchive="$tmpPath/hg-archive"

View file

@ -41,7 +41,7 @@ fi
# If we don't know the hash or a path with that hash doesn't exist,
# download the file and add it to the store.
if test -z "$finalPath"; then
tmpPath="$(mktemp --tmpdir -d svn-checkout-tmp-XXXXXXXX)"
tmpPath="$(mktemp -d "${TMPDIR:-/tmp}/svn-checkout-tmp-XXXXXXXX")"
trap "rm -rf \"$tmpPath\"" EXIT
tmpFile="$tmpPath/$dstFile"