Skip to content

Commit f6c2bfe

Browse files
committed
ruby-build now supports $RUBY_BUILD_BUILD_PATH to specify the location of the BUILD_PATH instead of a seeded directory under TMP
1 parent e69f559 commit f6c2bfe

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

bin/ruby-build

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ build_failed() {
2828
echo "BUILD FAILED"
2929
echo
3030

31-
if ! rmdir "${TEMP_PATH}" 2>/dev/null; then
32-
echo "Inspect or clean up the working tree at ${TEMP_PATH}"
31+
if ! rmdir "${BUILD_PATH}" 2>/dev/null; then
32+
echo "Inspect or clean up the working tree at ${BUILD_PATH}"
3333

3434
if file_is_not_empty "$LOG_PATH"; then
3535
echo "Results logged to ${LOG_PATH}"
@@ -68,7 +68,7 @@ install_package_using() {
6868
local package_name="$3"
6969
shift 3
7070

71-
pushd "$TEMP_PATH" >&4
71+
pushd "$BUILD_PATH" >&4
7272
"fetch_${package_type}" "$package_name" $*
7373
shift $(($package_type_nargs))
7474
make_package "$package_name" $*
@@ -404,10 +404,15 @@ fi
404404

405405
SEED="$(date "+%Y%m%d%H%M%S").$$"
406406
LOG_PATH="${TMP}/ruby-build.${SEED}.log"
407-
TEMP_PATH="${TMP}/ruby-build.${SEED}"
408407
RUBY_BIN="${PREFIX_PATH}/bin/ruby"
409408
CWD="$(pwd)"
410409

410+
if [ -z $RUBY_BUILD_BUILD_PATH ]; then
411+
BUILD_PATH="${TMP}/ruby-build.${SEED}"
412+
else
413+
BUILD_PATH=$RUBY_BUILD_BUILD_PATH
414+
fi
415+
411416
exec 4<> "$LOG_PATH" # open the log file at fd 4
412417
if [ -n "$VERBOSE" ]; then
413418
tail -f "$LOG_PATH" &
@@ -421,7 +426,7 @@ unset RUBYOPT
421426
unset RUBYLIB
422427

423428
trap build_failed ERR
424-
mkdir -p "$TEMP_PATH"
429+
mkdir -p "$BUILD_PATH"
425430
source "$DEFINITION_PATH"
426-
rm -fr "$TEMP_PATH"
431+
rm -fr "$BUILD_PATH"
427432
trap - ERR

0 commit comments

Comments
 (0)