Skip to content

Commit

Permalink
Add RUBY_BUILD_TARBALL_OVERRIDE to override the ruby tarball URL
Browse files Browse the repository at this point in the history
* Update the check for whether a package is a ruby.
  • Loading branch information
eregon committed Oct 11, 2023
1 parent d9af2ad commit 06a58c4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions bin/ruby-build
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ fetch_tarball() {
local checksum
local extracted_dir

if is_ruby_package "$1" && [ -n "$RUBY_BUILD_TARBALL_OVERRIDE" ]; then
package_url="$RUBY_BUILD_TARBALL_OVERRIDE"
fi

if [ "$package_url" != "${package_url/\#}" ]; then
checksum="${package_url#*#}"
package_url="${package_url%%#*}"
Expand Down Expand Up @@ -1203,14 +1207,23 @@ isolated_gem_install() {

apply_ruby_patch() {
local patchfile
case "$1" in
ruby-* | jruby-* | rubinius-* | truffleruby-* )
if is_ruby_package "$1"; then
patchfile="$(mktemp "${TMP}/ruby-patch.XXXXXX")"
cat "${2:--}" >"$patchfile"

local striplevel=0
grep -q '^--- a/' "$patchfile" && striplevel=1
patch -p$striplevel --force -i "$patchfile"
fi
}

is_ruby_package() {
case "$1" in
ruby-* | jruby-* | rubinius-* | truffleruby[+-]* | mruby-* | picoruby-* )
return 0
;;
*)
return 1
;;
esac
}
Expand Down

0 comments on commit 06a58c4

Please sign in to comment.