Skip to content

Commit

Permalink
Cleanup in truffleruby+graalvm installation
Browse files Browse the repository at this point in the history
Reuse original `build_package_copy` instead of having to maintain an additional `build_package_copy_to` step.

As a bonus, this prevents a global variable `to` from leaking.
  • Loading branch information
mislav authored and eregon committed Oct 14, 2023
1 parent 536495d commit 7773f82
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions bin/ruby-build
Original file line number Diff line number Diff line change
Expand Up @@ -821,12 +821,14 @@ build_package_truffleruby() {

build_package_truffleruby_graalvm() {
clean_prefix_path_truffleruby || return $?
build_package_copy_to "${PREFIX_PATH}/graalvm"
PREFIX_PATH="${PREFIX_PATH}/graalvm" build_package_copy

# shellcheck disable=SC2164
cd "${PREFIX_PATH}/graalvm"
if is_mac; then
cd Contents/Home || return $?
# shellcheck disable=SC2164
cd "${PREFIX_PATH}/graalvm/Contents/Home"
else
# shellcheck disable=SC2164
cd "${PREFIX_PATH}/graalvm"
fi

if [ -e bin/gu ]; then
Expand Down Expand Up @@ -879,14 +881,9 @@ clean_prefix_path_truffleruby() {
rm -rf "$PREFIX_PATH"
}

build_package_copy_to() {
to="$1"
mkdir -p "$to"
cp -fR . "$to"
}

build_package_copy() {
build_package_copy_to "$PREFIX_PATH"
mkdir -p "$PREFIX_PATH"
cp -fR . "$PREFIX_PATH"
}

before_install_package() {
Expand Down

0 comments on commit 7773f82

Please sign in to comment.