Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vendor-install: fix incorrect portable Ruby version reference. #17504

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Library/Homebrew/cmd/vendor-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# HOMEBREW_MACOS_VERSION_NUMERIC and HOMEBREW_PROCESSOR are set by brew.sh
# shellcheck disable=SC2154
source "${HOMEBREW_LIBRARY}/Homebrew/utils/lock.sh"
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"

VENDOR_DIR="${HOMEBREW_LIBRARY}/Homebrew/vendor"

Expand All @@ -21,18 +22,18 @@ set_ruby_variables() {
# use a x86_64 Portable Ruby.
[[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" && "${HOMEBREW_PREFIX}" == "/usr/local" ]]
then
ruby_FILENAME="portable-ruby-3.3.3.el_capitan.bottle.tar.gz"
ruby_FILENAME="portable-ruby-${HOMEBREW_PORTABLE_RUBY_VERSION}.el_capitan.bottle.tar.gz"
ruby_SHA="a5ef040e054444a0eb2cbcc1032fed14702dfbe2e55b25e609f3ce643f23c4ee"
elif [[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" ]]
then
ruby_FILENAME="portable-ruby-3.3.3.arm64_big_sur.bottle.tar.gz"
ruby_FILENAME="portable-ruby-${HOMEBREW_PORTABLE_RUBY_VERSION}.arm64_big_sur.bottle.tar.gz"
ruby_SHA="49847c7a13f7094b211f6d0025900dd23716be07dac894a3d6941d7696296306"
fi
elif [[ -n "${HOMEBREW_LINUX}" ]]
then
case "${VENDOR_PROCESSOR}" in
x86_64)
ruby_FILENAME="portable-ruby-3.3.3.x86_64_linux.bottle.tar.gz"
ruby_FILENAME="portable-ruby-${HOMEBREW_PORTABLE_RUBY_VERSION}.x86_64_linux.bottle.tar.gz"
ruby_SHA="40a1dbc25bb1a8bbdf0bba53d3f16c45416be12d4c6d48b4530f90b2a77d64ce"
;;
*) ;;
Expand All @@ -59,7 +60,7 @@ set_ruby_variables() {
fi
ruby_URLs+=(
"https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}"
"https://github.com/Homebrew/homebrew-portable-ruby/releases/download/3.3.3/${ruby_FILENAME}"
"https://github.com/Homebrew/homebrew-portable-ruby/releases/download/${HOMEBREW_PORTABLE_RUBY_VERSION}/${ruby_FILENAME}"
)
ruby_URL="${ruby_URLs[0]}"
fi
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/standalone/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
require "pathname"
dir = __dir__ || raise("__dir__ is not defined")
HOMEBREW_LIBRARY_PATH = Pathname(dir).parent.realpath.freeze
HOMEBREW_USING_PORTABLE_RUBY = Pathname.new(RbConfig.ruby).to_s.include?("/vendor/portable-ruby/").freeze
HOMEBREW_USING_PORTABLE_RUBY = RbConfig.ruby.include?("/vendor/portable-ruby/").freeze

require_relative "../utils/gems"
Homebrew.setup_gem_environment!(setup_path: false)
Expand Down
11 changes: 6 additions & 5 deletions Library/Homebrew/utils/ruby.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# When bumping, run `brew vendor-gems --update=--ruby`
# When bumping to a new major/minor version, also update the bounds in the Gemfile
export HOMEBREW_REQUIRED_RUBY_VERSION=3.3
# HOMEBREW_LIBRARY set by bin/brew
# shellcheck disable=SC2154
export HOMEBREW_REQUIRED_RUBY_VERSION="3.3"
HOMEBREW_PORTABLE_RUBY_VERSION="$(cat "${HOMEBREW_LIBRARY}/Homebrew/vendor/portable-ruby-version")"

# Disable Ruby options we don't need.
export HOMEBREW_RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt"

# HOMEBREW_LIBRARY is from the user environment
# HOMEBREW_LIBRARY set by bin/brew
# shellcheck disable=SC2154
test_ruby() {
if [[ ! -x "$1" ]]
Expand Down Expand Up @@ -88,7 +91,6 @@ setup-ruby-path() {
local vendor_ruby_root
local vendor_ruby_path
local vendor_ruby_terminfo
local vendor_ruby_latest_version
local vendor_ruby_current_version
local ruby_exec
local upgrade_fail
Expand All @@ -113,7 +115,6 @@ If there's no Homebrew Portable Ruby available for your processor:
vendor_ruby_root="${vendor_dir}/portable-ruby/current"
vendor_ruby_path="${vendor_ruby_root}/bin/ruby"
vendor_ruby_terminfo="${vendor_ruby_root}/share/terminfo"
vendor_ruby_latest_version="$(cat "${vendor_dir}/portable-ruby-version")"
vendor_ruby_current_version="$(readlink "${vendor_ruby_root}")"

unset HOMEBREW_RUBY_PATH
Expand All @@ -127,7 +128,7 @@ If there's no Homebrew Portable Ruby available for your processor:
then
HOMEBREW_RUBY_PATH="${vendor_ruby_path}"
TERMINFO_DIRS="${vendor_ruby_terminfo}"
if [[ "${vendor_ruby_current_version}" != "${vendor_ruby_latest_version}" ]]
if [[ "${vendor_ruby_current_version}" != "${HOMEBREW_PORTABLE_RUBY_VERSION}" ]]
then
brew vendor-install ruby || odie "${upgrade_fail}"
fi
Expand Down
1 change: 0 additions & 1 deletion docs/.ruby-version

This file was deleted.

1 change: 1 addition & 0 deletions docs/.ruby-version