mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Properly handle outdated cURL
`HOMEBREW_CURL_PATH` has an effect only when `HOMEBREW_DEVELOPER` is set. However, the part of `brew.sh` that prints a message about outdated cURL disregards the value of `HOMEBREW_DEVELOPER`, which leads to a misleadnig message telling the user that `HOMEBREW_CURL_PATH` is outdated even though another cURL was used/tested. This PR fixes it and instructs Homebrew to: 1. Display a warning message when system cURL is outdated and either `HOMEBREW_CURL_PATH` **or `HOMEBREW_DEVELOPER`** are not set. New `HOMEBREW_CURL_WARNING` variable is set to display the above warning only once (useful when `brew` calls itself internally). 2. Display `Installing Homebrew cURL` before auto-installing cURL in `update.sh` (due to `HOMEBREW_FORCE_BREWED_CURL`) and stop/exit if this step fails. 3. Display `Installing Homebrew Git` before auto-installing Git in `update.sh` (due to `HOMEBREW_FORCE_BREWED_GIT`) and stop/exit if this step fails.
This commit is contained in:
parent
66b6828ab5
commit
22bc5a94e7
@ -350,17 +350,23 @@ else
|
||||
curl_name_and_version="${curl_version_output%% (*}"
|
||||
if [[ $(numeric "${curl_name_and_version##* }") -lt $(numeric "$HOMEBREW_MINIMUM_CURL_VERSION") ]]
|
||||
then
|
||||
if [[ -z $HOMEBREW_CURL_PATH ]]; then
|
||||
message="Your cURL version is too old.
|
||||
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}
|
||||
Your cURL version: ${curl_name_and_version##* }
|
||||
Your cURL executable: $(type -p $HOMEBREW_CURL)
|
||||
To point Homebrew to cURL ${HOMEBREW_MINIMUM_CURL_VERSION} or newer,
|
||||
enable developer mode by setting HOMEBREW_DEVELOPER to 1,
|
||||
then set HOMEBREW_CURL_PATH to the location of cURL executable."
|
||||
|
||||
if [[ -z $HOMEBREW_CURL_PATH || -z $HOMEBREW_DEVELOPER ]]; then
|
||||
HOMEBREW_SYSTEM_CURL_TOO_OLD=1
|
||||
HOMEBREW_FORCE_BREWED_CURL=1
|
||||
if [[ -z $HOMEBREW_CURL_WARNING ]]; then
|
||||
onoe "$message"
|
||||
HOMEBREW_CURL_WARNING=1
|
||||
fi
|
||||
else
|
||||
odie <<EOS
|
||||
The version of cURL that you provided to Homebrew using HOMEBREW_CURL_PATH is too old.
|
||||
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}.
|
||||
Your cURL version: ${curl_name_and_version##* }.
|
||||
Please point Homebrew to cURL ${HOMEBREW_MINIMUM_CURL_VERSION} or newer
|
||||
or unset HOMEBREW_CURL_PATH variable.
|
||||
EOS
|
||||
odie "$message"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -418,6 +424,7 @@ export HOMEBREW_TEMP
|
||||
export HOMEBREW_CELLAR
|
||||
export HOMEBREW_SYSTEM
|
||||
export HOMEBREW_CURL
|
||||
export HOMEBREW_CURL_WARNING
|
||||
export HOMEBREW_SYSTEM_CURL_TOO_OLD
|
||||
export HOMEBREW_GIT
|
||||
export HOMEBREW_MINIMUM_GIT_VERSION
|
||||
|
@ -372,7 +372,8 @@ EOS
|
||||
if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&
|
||||
! -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
|
||||
then
|
||||
brew install curl
|
||||
ohai "Installing Homebrew cURL"
|
||||
brew install curl || odie "Failed to install cURL"
|
||||
fi
|
||||
|
||||
if ! git --version &>/dev/null ||
|
||||
@ -380,7 +381,11 @@ EOS
|
||||
! -x "$HOMEBREW_PREFIX/opt/git/bin/git" ]]
|
||||
then
|
||||
# we cannot install brewed git if homebrew/core is unavailable.
|
||||
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git
|
||||
if [[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]]
|
||||
then
|
||||
ohai "Installing Homebrew Git"
|
||||
brew install git || odie "Failed to install Git"
|
||||
fi
|
||||
unset GIT_EXECUTABLE
|
||||
if ! git --version &>/dev/null
|
||||
then
|
||||
|
Loading…
x
Reference in New Issue
Block a user