summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-07-18 12:00:38 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-07-18 12:00:38 +0000
commit0a355c0073563dd25b834c3024c0fb58bff85649 (patch)
tree065ecd11807f72e44395317693a29bd79adac136 /pkgs/build-support
parent38420dfd6fcd932fd5c98b0f73b78fd0fc0f611c (diff)
downloadnixlib-0a355c0073563dd25b834c3024c0fb58bff85649.tar
nixlib-0a355c0073563dd25b834c3024c0fb58bff85649.tar.gz
nixlib-0a355c0073563dd25b834c3024c0fb58bff85649.tar.bz2
nixlib-0a355c0073563dd25b834c3024c0fb58bff85649.tar.lz
nixlib-0a355c0073563dd25b834c3024c0fb58bff85649.tar.xz
nixlib-0a355c0073563dd25b834c3024c0fb58bff85649.tar.zst
nixlib-0a355c0073563dd25b834c3024c0fb58bff85649.zip
* Don't pollute /tmp.
svn path=/nixpkgs/trunk/; revision=5769
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-xpkgs/build-support/fetchsvn/nix-prefetch-svn5
1 files changed, 2 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchsvn/nix-prefetch-svn b/pkgs/build-support/fetchsvn/nix-prefetch-svn
index e8b849a1bbbe..cfefee70b030 100755
--- a/pkgs/build-support/fetchsvn/nix-prefetch-svn
+++ b/pkgs/build-support/fetchsvn/nix-prefetch-svn
@@ -36,11 +36,12 @@ fi
 # download the file and add it to the store.
 if test -z "$finalPath"; then
 
-    # !!! race? should be relatively safe, `svn export' barfs if $tmpPath exists.
     tmpPath=/tmp/svn-checkout-tmp-$$
     tmpFile=$tmpPath/svn-export
     mkdir $tmpPath
 
+    trap "rm -rf $tmpPath" EXIT
+
     # Perform the checkout.
     # !!! remove 2>/dev/null when we have fixed the certificate hackery.
     echo p | svn export -r "$rev" "$url" $tmpFile 2>/dev/null >&2
@@ -52,8 +53,6 @@ if test -z "$finalPath"; then
     # Add the downloaded file to the Nix store.
     finalPath=$(nix-store --add-fixed --recursive "$hashType" $tmpFile)
 
-    if test -n "$tmpPath"; then rm -rf $tmpPath || true; fi
-
     if test -n "$expHash" -a "$expHash" != "$hash"; then
         echo "hash mismatch for URL \`$url'"
         exit 1