Merge pull request #11938 from iMichka/domain

brew.sh: set HOMEBREW_FORCE_HOMEBREW_ON_LINUX when core repo is homeb…
This commit is contained in:
Mike McQuaid 2021-09-01 11:24:53 +01:00 committed by GitHub
commit 364096b79e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 103 additions and 76 deletions

View File

@ -27,7 +27,9 @@ module Homebrew
sig { params(name: String).returns(T.nilable(PkgVersion)) }
def latest_formula_version(name)
versions = if OS.mac? || Homebrew::EnvConfig.force_homebrew_on_linux?
versions = if OS.mac? ||
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
formulae
else
linux

View File

@ -469,6 +469,17 @@ Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION="2.13"
unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
HOMEBREW_CORE_REPOSITORY_ORIGIN="$("${HOMEBREW_GIT}" -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin)"
if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" = "https://github.com/Homebrew/homebrew-core" ]]
then
# If the remote origin has been set to Homebrew/homebrew-core by the install script,
# then we are in the case of a new installation of brew, using Homebrew/homebrew-core as a Linux core repository.
# In that case, set HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX=1 to set the right HOMEBREW_BOTTLE_DOMAIN below.
# TODO: Once the linuxbrew-core migration is done we will be able to clean this up and
# remove HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX
export HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX="1"
fi
fi
# A bug in the auto-update process prior to 3.1.2 means $HOMEBREW_BOTTLE_DOMAIN
@ -484,7 +495,7 @@ then
unset HOMEBREW_BOTTLE_DOMAIN
fi
if [[ -n "${HOMEBREW_MACOS}" || -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]]
if [[ -n "${HOMEBREW_MACOS}" || -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" || -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
then
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/homebrew/core"
else
@ -624,7 +635,7 @@ then
fi
export HOMEBREW_BREW_GIT_REMOTE
if [[ -n "${HOMEBREW_MACOS}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]]
if [[ -n "${HOMEBREW_MACOS}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
then
HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
else

View File

@ -277,6 +277,10 @@ module Homebrew
"when auditing macOS formulae while on Linux. Implies `HOMEBREW_FORCE_HOMEBREW_ON_LINUX`.",
boolean: true,
},
HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX: {
description: "If set, running Homebrew on Linux will use homebrew-core instead of linuxbrew-core.",
boolean: true,
},
HOMEBREW_SKIP_OR_LATER_BOTTLES: {
description: "If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions " \
"of macOS. This is useful in development on new macOS versions.",

View File

@ -6,7 +6,9 @@ module Homebrew
module Analytics
class << self
def analytics_api_path
return generic_analytics_api_path if Homebrew::EnvConfig.force_homebrew_on_linux?
return generic_analytics_api_path if
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
"analytics-linux"
end

View File

@ -6,7 +6,9 @@ module Homebrew
module Bottle
class << self
def bottle_api_path
return generic_bottle_api_path if Homebrew::EnvConfig.force_homebrew_on_linux?
return generic_bottle_api_path if
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
"bottle-linux"
end

View File

@ -6,7 +6,9 @@ module Homebrew
module Formula
class << self
def formula_api_path
return generic_formula_api_path if Homebrew::EnvConfig.force_homebrew_on_linux?
return generic_formula_api_path if
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
"formula-linux"
end

View File

@ -5,6 +5,8 @@ class CoreTap < Tap
# @private
def initialize
super "Homebrew", "core"
@full_name = "Homebrew/linuxbrew-core" unless Homebrew::EnvConfig.force_homebrew_on_linux?
@full_name = "Homebrew/linuxbrew-core" if
!Homebrew::EnvConfig.force_homebrew_on_linux? &&
!Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
end
end

View File

@ -9817,6 +9817,8 @@ module Homebrew::EnvConfig
def self.force_homebrew_on_linux?(); end
def self.force_homebrew_core_repo_on_linux?(); end
def self.force_vendor_ruby?(); end
def self.ftp_proxy(); end