cmd/vendor-install: extract portable-ruby download info

This commit is contained in:
Caleb Xu 2024-06-24 12:10:46 -04:00
parent 43eaeca50f
commit c214952e2b
No known key found for this signature in database
GPG Key ID: 47E6040D07B8407D
4 changed files with 30 additions and 20 deletions

View File

@ -14,36 +14,37 @@ VENDOR_DIR="${HOMEBREW_LIBRARY}/Homebrew/vendor"
# Built from https://github.com/Homebrew/homebrew-portable-ruby. # Built from https://github.com/Homebrew/homebrew-portable-ruby.
set_ruby_variables() { set_ruby_variables() {
if [[ -n "${HOMEBREW_MACOS}" ]]
then
if [[ "${VENDOR_PHYSICAL_PROCESSOR}" == "x86_64" ]] ||
# Handle the case where /usr/local/bin/brew is run under arm64. # Handle the case where /usr/local/bin/brew is run under arm64.
# It's a x86_64 installation there (we refuse to install arm64 binaries) so # It's a x86_64 installation there (we refuse to install arm64 binaries) so
# use a x86_64 Portable Ruby. # use a x86_64 Portable Ruby.
[[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" && "${HOMEBREW_PREFIX}" == "/usr/local" ]] if [[ -n "${HOMEBREW_MACOS}" && "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" && "${HOMEBREW_PREFIX}" == "/usr/local" ]]
then then
ruby_FILENAME="portable-ruby-${HOMEBREW_PORTABLE_RUBY_VERSION}.el_capitan.bottle.tar.gz" ruby_PROCESSOR="x86_64"
ruby_SHA="a5ef040e054444a0eb2cbcc1032fed14702dfbe2e55b25e609f3ce643f23c4ee" ruby_OS="darwin"
elif [[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" ]] else
ruby_PROCESSOR="${VENDOR_PHYSICAL_PROCESSOR}"
if [[ -n "${HOMEBREW_MACOS}" ]]
then then
ruby_FILENAME="portable-ruby-${HOMEBREW_PORTABLE_RUBY_VERSION}.arm64_big_sur.bottle.tar.gz" ruby_OS="darwin"
ruby_SHA="49847c7a13f7094b211f6d0025900dd23716be07dac894a3d6941d7696296306"
fi
elif [[ -n "${HOMEBREW_LINUX}" ]] elif [[ -n "${HOMEBREW_LINUX}" ]]
then then
case "${VENDOR_PROCESSOR}" in ruby_OS="linux"
x86_64) fi
ruby_FILENAME="portable-ruby-${HOMEBREW_PORTABLE_RUBY_VERSION}.x86_64_linux.bottle.tar.gz" fi
ruby_SHA="40a1dbc25bb1a8bbdf0bba53d3f16c45416be12d4c6d48b4530f90b2a77d64ce"
;; ruby_PLATFORMINFO="${HOMEBREW_LIBRARY}/Homebrew/vendor/portable-ruby-${ruby_PROCESSOR}-${ruby_OS}"
*) ;; if [[ -f "${ruby_PLATFORMINFO}" ]]
esac then
# ruby_TAG and ruby_SHA will be set via the sourced file if it exists
# shellcheck disable=SC1090
source "${ruby_PLATFORMINFO}"
fi fi
# Dynamic variables can't be detected by shellcheck # Dynamic variables can't be detected by shellcheck
# shellcheck disable=SC2034 # shellcheck disable=SC2034
if [[ -n "${ruby_SHA}" && -n "${ruby_FILENAME}" ]] if [[ -n "${ruby_TAG}" && -n "${ruby_SHA}" ]]
then then
ruby_FILENAME="portable-ruby-${HOMEBREW_PORTABLE_RUBY_VERSION}.${ruby_TAG}.bottle.tar.gz"
ruby_URLs=() ruby_URLs=()
if [[ -n "${HOMEBREW_ARTIFACT_DOMAIN}" ]] if [[ -n "${HOMEBREW_ARTIFACT_DOMAIN}" ]]
then then
@ -284,6 +285,9 @@ homebrew-vendor-install() {
local url_var local url_var
local sha_var local sha_var
unset VENDOR_PHYSICAL_PROCESSOR
unset VENDOR_PROCESSOR
for option in "$@" for option in "$@"
do do
case "${option}" in case "${option}" in

View File

@ -0,0 +1,2 @@
ruby_TAG=arm64_big_sur
ruby_SHA=49847c7a13f7094b211f6d0025900dd23716be07dac894a3d6941d7696296306

View File

@ -0,0 +1,2 @@
ruby_TAG=el_capitan
ruby_SHA=a5ef040e054444a0eb2cbcc1032fed14702dfbe2e55b25e609f3ce643f23c4ee

View File

@ -0,0 +1,2 @@
ruby_TAG=x86_64_linux
ruby_SHA=40a1dbc25bb1a8bbdf0bba53d3f16c45416be12d4c6d48b4530f90b2a77d64ce