diff --git a/pkgs/build-support/fetchbzr/nix-prefetch-bzr b/pkgs/build-support/fetchbzr/nix-prefetch-bzr index 2f46819323f2..346c2b05cbdd 100755 --- a/pkgs/build-support/fetchbzr/nix-prefetch-bzr +++ b/pkgs/build-support/fetchbzr/nix-prefetch-bzr @@ -43,11 +43,10 @@ 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=/tmp/bzr-checkout-tmp-$$ - tmpFile=$tmpPath/$dstFile - mkdir $tmpPath + tmpPath="$(mktemp --tmpdir -d bzr-checkout-tmp-XXXXXXXX)" + trap "rm -rf \"$tmpPath\"" EXIT - trap "rm -rf $tmpPath" EXIT + tmpFile="$tmpPath/$dstFile" # Perform the checkout. bzr -Ossl.cert_reqs=none export $revarg --format=dir "$tmpFile" "$url" diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index b3cd3488735c..0d2536e225c3 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -256,11 +256,11 @@ else # download the file and add it to the store. if test -z "$finalPath"; then - tmpPath=/tmp/git-checkout-tmp-$$ - tmpFile=$tmpPath/git-export - mkdir $tmpPath $tmpFile + tmpPath="$(mktemp --tmpdir -d git-checkout-tmp-XXXXXXXX)" + trap "rm -rf \"$tmpPath\"" EXIT - trap "rm -rf $tmpPath" EXIT + tmpFile="$tmpPath/git-export" + mkdir "$tmpFile" # Perform the checkout. clone_user_rev "$tmpFile" "$url" "$rev" diff --git a/pkgs/build-support/fetchhg/nix-prefetch-hg b/pkgs/build-support/fetchhg/nix-prefetch-hg index 075dbc9c367b..7d4c0c8d7413 100755 --- a/pkgs/build-support/fetchhg/nix-prefetch-hg +++ b/pkgs/build-support/fetchhg/nix-prefetch-hg @@ -35,11 +35,10 @@ fi # download the file and add it to the store. if test -z "$finalPath"; then - tmpPath=/tmp/hg-checkout-tmp-$$ - tmpArchive=$tmpPath/hg-archive - mkdir $tmpPath + tmpPath="$(mktemp --tmpdir -d hg-checkout-tmp-XXXXXXXX)" + trap "rm -rf \"$tmpPath\"" EXIT - trap "rm -rf $tmpPath" EXIT + tmpArchive="$tmpPath/hg-archive" # Perform the checkout. if [[ $url != /* ]]; then diff --git a/pkgs/build-support/fetchsvn/nix-prefetch-svn b/pkgs/build-support/fetchsvn/nix-prefetch-svn index a2ee3ac6052f..74de0a14c801 100755 --- a/pkgs/build-support/fetchsvn/nix-prefetch-svn +++ b/pkgs/build-support/fetchsvn/nix-prefetch-svn @@ -41,11 +41,10 @@ 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=/tmp/svn-checkout-tmp-$$ - tmpFile=$tmpPath/$dstFile - mkdir $tmpPath + tmpPath="$(mktemp --tmpdir -d svn-checkout-tmp-XXXXXXXX)" + trap "rm -rf \"$tmpPath\"" EXIT - trap "rm -rf $tmpPath" EXIT + tmpFile="$tmpPath/$dstFile" # Perform the checkout. if test "$NIX_PREFETCH_SVN_LEAVE_DOT_SVN" != 1