more robust for parallel runs
[infrastructure.git] / scripts / vbuild-nightly.sh
index 10c72a5..92f5639 100755 (executable)
@@ -18,9 +18,10 @@ function scan_build_scm_url () {
 
 scan_build_scm_url "$@"
 
-tmp=/tmp/$COMMAND-$$
-git archive --remote=$GIT_REPO $GIT_TAG $COMMAND | tar -C /tmp -xf -
-mv /tmp/$COMMAND $tmp
-chmod +x $tmp
-$tmp "$@"
-rm $tmp
+tmpd=/tmp/git-$$
+tmpc=$tpmd/$COMMAND
+mkdir $tmpd
+git archive --remote=$GIT_REPO $GIT_TAG $COMMAND | tar -C $tmpd -xf -
+chmod +x $tmc
+$tmpc "$@"
+rm -rf $tmpd