mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Tweaks for older Mac OS X versions.
- `brew update` should try to install `curl` before `git` on older versions of Mac OS X where it is needed for accessing modern SSL certificates. - We don't need an HTTP mirror for `git` because `curl` will already be installed before it is downloaded. - Don't recommend GCC on Mac OS X versions where it can't be built with the default system compiler. - Start using the Homebrew `curl` on Mac OS X versions where it is needed as soon as it is installed.
This commit is contained in:
parent
c0063bb827
commit
ffdda0eb9f
@ -105,7 +105,14 @@ then
|
|||||||
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X $HOMEBREW_MACOS_VERSION"
|
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X $HOMEBREW_MACOS_VERSION"
|
||||||
|
|
||||||
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
|
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
|
||||||
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" &&
|
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
|
||||||
|
then
|
||||||
|
HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The system Curl is too old for some modern HTTPS certificates on
|
||||||
|
# older macOS versions.
|
||||||
|
if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
|
||||||
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
|
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl"
|
HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl"
|
||||||
|
@ -385,6 +385,12 @@ EOS
|
|||||||
|
|
||||||
if ! git --version >/dev/null 2>&1
|
if ! git --version >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
|
# we need a new enough curl to install git
|
||||||
|
if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
|
||||||
|
! -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
|
||||||
|
then
|
||||||
|
brew install curl
|
||||||
|
fi
|
||||||
# we cannot install brewed git if homebrew/core is unavailable.
|
# we cannot install brewed git if homebrew/core is unavailable.
|
||||||
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git
|
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git
|
||||||
unset GIT_EXECUTABLE
|
unset GIT_EXECUTABLE
|
||||||
|
@ -574,7 +574,7 @@ class FormulaAuditor
|
|||||||
|
|
||||||
return unless @online
|
return unless @online
|
||||||
|
|
||||||
return unless DevelopmentTools.curl_handles_most_https_homepages?
|
return unless DevelopmentTools.curl_handles_most_https_certificates?
|
||||||
if http_content_problem = FormulaAuditor.check_http_content(homepage,
|
if http_content_problem = FormulaAuditor.check_http_content(homepage,
|
||||||
user_agents: [:browser, :default],
|
user_agents: [:browser, :default],
|
||||||
check_content: true,
|
check_content: true,
|
||||||
@ -1175,9 +1175,9 @@ class ResourceAuditor
|
|||||||
problem "Redundant :using value in URL"
|
problem "Redundant :using value in URL"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.curl_git_openssl_and_deps
|
def self.curl_openssl_and_deps
|
||||||
@curl_git_openssl_and_deps ||= begin
|
@curl_openssl_and_deps ||= begin
|
||||||
formulae_names = ["curl", "git", "openssl"]
|
formulae_names = ["curl", "openssl"]
|
||||||
formulae_names += formulae_names.flat_map do |f|
|
formulae_names += formulae_names.flat_map do |f|
|
||||||
Formula[f].recursive_dependencies.map(&:name)
|
Formula[f].recursive_dependencies.map(&:name)
|
||||||
end
|
end
|
||||||
@ -1190,11 +1190,14 @@ class ResourceAuditor
|
|||||||
def audit_urls
|
def audit_urls
|
||||||
urls = [url] + mirrors
|
urls = [url] + mirrors
|
||||||
|
|
||||||
require_http = ResourceAuditor.curl_git_openssl_and_deps.include?(owner.name)
|
curl_openssl_or_deps = ResourceAuditor.curl_openssl_and_deps.include?(owner.name)
|
||||||
|
|
||||||
if spec_name == :stable && require_http &&
|
if spec_name == :stable && curl_openssl_or_deps
|
||||||
!urls.find { |u| u.start_with?("http://") }
|
problem "should not use xz tarballs" if url.end_with?(".xz")
|
||||||
problem "should always include at least one HTTP mirror"
|
|
||||||
|
unless urls.find { |u| u.start_with?("http://") }
|
||||||
|
problem "should always include at least one HTTP mirror"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless @online
|
return unless @online
|
||||||
@ -1206,7 +1209,7 @@ class ResourceAuditor
|
|||||||
# A `brew mirror`'ed URL is usually not yet reachable at the time of
|
# A `brew mirror`'ed URL is usually not yet reachable at the time of
|
||||||
# pull request.
|
# pull request.
|
||||||
next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/}
|
next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/}
|
||||||
if http_content_problem = FormulaAuditor.check_http_content(url, require_http: require_http)
|
if http_content_problem = FormulaAuditor.check_http_content(url, require_http: curl_openssl_or_deps)
|
||||||
problem http_content_problem
|
problem http_content_problem
|
||||||
end
|
end
|
||||||
elsif strategy <= GitDownloadStrategy
|
elsif strategy <= GitDownloadStrategy
|
||||||
|
@ -114,7 +114,7 @@ class DevelopmentTools
|
|||||||
@non_apple_gcc_version = {}
|
@non_apple_gcc_version = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl_handles_most_https_homepages?
|
def curl_handles_most_https_certificates?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,11 +43,16 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
def custom_installation_instructions
|
def custom_installation_instructions
|
||||||
if MacOS.version > :tiger
|
if MacOS.version > :leopard
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
Install GNU's GCC
|
Install GNU's GCC
|
||||||
brew install gcc
|
brew install gcc
|
||||||
EOS
|
EOS
|
||||||
|
elsif MacOS.version > :tiger
|
||||||
|
<<-EOS.undent
|
||||||
|
Install GNU's GCC
|
||||||
|
brew install gcc@4.6
|
||||||
|
EOS
|
||||||
else
|
else
|
||||||
# Tiger doesn't ship with apple-gcc42, and this is required to build
|
# Tiger doesn't ship with apple-gcc42, and this is required to build
|
||||||
# some software that doesn't build properly with FSF GCC.
|
# some software that doesn't build properly with FSF GCC.
|
||||||
@ -55,7 +60,7 @@ class DevelopmentTools
|
|||||||
Install Apple's GCC
|
Install Apple's GCC
|
||||||
brew install apple-gcc42
|
brew install apple-gcc42
|
||||||
or GNU's GCC
|
or GNU's GCC
|
||||||
brew install gcc
|
brew install gcc@4.6
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -77,10 +82,10 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl_handles_most_https_homepages?
|
def curl_handles_most_https_certificates?
|
||||||
# The system Curl is too old for some modern HTTPS homepages on
|
# The system Curl is too old for some modern HTTPS certificates on
|
||||||
# older macOS versions.
|
# older macOS versions.
|
||||||
MacOS.version >= :el_capitan
|
!ENV["HOMEBREW_SYSTEM_CURL_TOO_OLD"].nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def subversion_handles_most_https_certificates?
|
def subversion_handles_most_https_certificates?
|
||||||
|
@ -603,6 +603,12 @@ class FormulaInstaller
|
|||||||
|
|
||||||
# let's reset Utils.git_available? if we just installed git
|
# let's reset Utils.git_available? if we just installed git
|
||||||
Utils.clear_git_available_cache if formula.name == "git"
|
Utils.clear_git_available_cache if formula.name == "git"
|
||||||
|
|
||||||
|
# use installed curl when it's needed and available
|
||||||
|
if formula.name == "curl" &&
|
||||||
|
!DevelopmentTools.curl_handles_most_https_certificates?
|
||||||
|
ENV["HOMEBREW_CURL"] = formula.opt_bin/"curl"
|
||||||
|
end
|
||||||
ensure
|
ensure
|
||||||
unlock
|
unlock
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user