Cleanup using `$tmpdir', and set it to a subdirectory of /tmp.

This commit is contained in:
Eli Barzilay 2012-01-05 20:16:10 -05:00
parent 13db1c1a08
commit aa0c90a2a0

View File

@ -179,9 +179,10 @@ index="index.html"
stampfile="stamp" stampfile="stamp"
# directory for temporary stuff (absolute path) -- on all machines # directory for temporary stuff (absolute path) -- on all machines
tmpdir="/tmp" tmpdir="/tmp/build"
mkdir -p "$tmpdir" # make sure that it exists asap
# lockfile for this script # lockfile for this script
lockfile="/tmp/racket-build-lock" lockfile="$tmpdir/racket-build-lock"
# name for running this script remotely # name for running this script remotely
remotebuildscript="$tmpdir/build-racket" remotebuildscript="$tmpdir/build-racket"
# full name for clean repository tgz file to transfer for distributed builds # full name for clean repository tgz file to transfer for distributed builds
@ -344,7 +345,7 @@ explanation_of_installer_type() {
# This is for running racket scripts, unrelated to the build itself # This is for running racket scripts, unrelated to the build itself
export PLTHOME="$maindir/$installdir" \ export PLTHOME="$maindir/$installdir" \
PLT_EXTENSION_LIB_PATHS="" \ PLT_EXTENSION_LIB_PATHS="" \
PLTPLANETDIR="/tmp/racket-build-planet" PLTPLANETDIR="$tmpdir/racket-build-planet"
export PATH="$PLTHOME/bin:$PATH" export PATH="$PLTHOME/bin:$PATH"
unset PLTCOLLECTS; export PLTCOLLECTS unset PLTCOLLECTS; export PLTCOLLECTS
@ -1317,21 +1318,23 @@ grab_one_batch_var() {
} }
grab_batch_vars() { # input: batchfile args ... grab_batch_vars() { # input: batchfile args ...
local exe="$1"; shift local exe="$1"; shift
local tmpbatch="/tmp/grab_vars.bat" local tmpbatch="$tmpdir/grab_vars.bat"
rm -f "$tmpbatch" rm -f "$tmpbatch"
cat >> "$tmpbatch" <<-EOF cat >> "$tmpbatch" <<-EOF
@echo off @echo off
"$(cygpath -w "$(which env)")" > "$(cygpath -w "/tmp/E1")" "$(cygpath -w "$(which env)")" > "$(cygpath -w "$tmpdir/E1")"
call "$exe" $* call "$exe" $*
"$(cygpath -w "$(which env)")" > "$(cygpath -w "/tmp/E2")" "$(cygpath -w "$(which env)")" > "$(cygpath -w "$tmpdir/E2")"
EOF EOF
chmod +x "$tmpbatch" chmod +x "$tmpbatch"
"$tmpbatch" "$tmpbatch"
rm "$tmpbatch" rm "$tmpbatch"
sort "/tmp/E1" | grep -v '^!' > "/tmp/E1s"; mv "/tmp/E1s" "/tmp/E1" local a_file
sort "/tmp/E2" | grep -v '^!' > "/tmp/E2s"; mv "/tmp/E2s" "/tmp/E2" for a_file in "$tmpdir/E1" "$tmpdir/E2"; do
local vars="$(comm -13 "/tmp/E1" "/tmp/E2")" sort "$a_file" | grep -v '^!' > "$a_file.s"; mv "$a_file.s" "$a_file"
rm "/tmp/E1" "/tmp/E2" done
local vars="$(comm -13 "$tmpdir/E1" "$tmpdir/E2")"
rm "$tmpdir/E1" "$tmpdir/E2"
local NL=$'\n' local NL=$'\n'
while [[ "$vars" = *"$NL"* ]]; do while [[ "$vars" = *"$NL"* ]]; do
grab_one_batch_var "${vars%%${NL}*}" grab_one_batch_var "${vars%%${NL}*}"