Merge pull request #5182 from EricFromCanada/prepend-shims-path
Prepend shims path to PATH used by `system` and `safe_system`
This commit is contained in:
commit
033386a75e
@ -37,8 +37,8 @@ begin
|
||||
homebrew_path = PATH.new(ENV["HOMEBREW_PATH"])
|
||||
|
||||
# Add SCM wrappers.
|
||||
path.append(HOMEBREW_SHIMS_PATH/"scm")
|
||||
homebrew_path.append(HOMEBREW_SHIMS_PATH/"scm")
|
||||
path.prepend(HOMEBREW_SHIMS_PATH/"scm")
|
||||
homebrew_path.prepend(HOMEBREW_SHIMS_PATH/"scm")
|
||||
|
||||
ENV["PATH"] = path
|
||||
|
||||
|
||||
@ -55,6 +55,12 @@ git() {
|
||||
"$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" "$@"
|
||||
}
|
||||
|
||||
numeric() {
|
||||
# Condense the exploded argument into a single return value.
|
||||
# shellcheck disable=SC2086,SC2183
|
||||
printf "%01d%02d%02d%02d" ${1//./ }
|
||||
}
|
||||
|
||||
HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)"
|
||||
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
|
||||
if [[ -z "$HOMEBREW_VERSION" ]]
|
||||
@ -99,7 +105,8 @@ then
|
||||
HOMEBREW_FORCE_BREWED_CURL="1"
|
||||
fi
|
||||
|
||||
# The system Git is too old for some Homebrew functionality we rely on.
|
||||
# The system Git on macOS versions before Sierra is too old for some Homebrew functionality we rely on.
|
||||
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
|
||||
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]]
|
||||
then
|
||||
HOMEBREW_FORCE_BREWED_GIT="1"
|
||||
@ -114,6 +121,25 @@ else
|
||||
: "${HOMEBREW_OS_VERSION:=$(uname -r)}"
|
||||
HOMEBREW_OS_USER_AGENT_VERSION="$HOMEBREW_OS_VERSION"
|
||||
|
||||
# Ensure the system Curl is a version that supports modern HTTPS certificates.
|
||||
HOMEBREW_MINIMUM_CURL_VERSION="7.41.0"
|
||||
system_curl_version_output="$($(command -v curl) --version 2>/dev/null)"
|
||||
system_curl_name_and_version="${system_curl_version_output%% (*}"
|
||||
if [[ $(numeric "${system_curl_name_and_version##* }") -lt $(numeric "$HOMEBREW_MINIMUM_CURL_VERSION") ]]
|
||||
then
|
||||
HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
|
||||
HOMEBREW_FORCE_BREWED_CURL="1"
|
||||
fi
|
||||
|
||||
# Ensure the system Git is at or newer than the minimum required version.
|
||||
# Git 2.7.4 is the version of git on Ubuntu 16.04 LTS (Xenial Xerus).
|
||||
HOMEBREW_MINIMUM_GIT_VERSION="2.7.0"
|
||||
system_git_version_output="$($(command -v git) --version 2>/dev/null)"
|
||||
if [[ $(numeric "${system_git_version_output##* }") -lt $(numeric "$HOMEBREW_MINIMUM_GIT_VERSION") ]]
|
||||
then
|
||||
HOMEBREW_FORCE_BREWED_GIT="1"
|
||||
fi
|
||||
|
||||
CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}"
|
||||
HOMEBREW_CACHE="${HOMEBREW_CACHE:-${CACHE_HOME}/Homebrew}"
|
||||
HOMEBREW_SYSTEM_TEMP="/tmp"
|
||||
@ -153,8 +179,9 @@ else
|
||||
fi
|
||||
|
||||
HOMEBREW_USER_AGENT="$HOMEBREW_PRODUCT/$HOMEBREW_USER_AGENT_VERSION ($HOMEBREW_SYSTEM; $HOMEBREW_PROCESSOR $HOMEBREW_OS_USER_AGENT_VERSION)"
|
||||
HOMEBREW_CURL_VERSION="$("$HOMEBREW_CURL" --version 2>/dev/null | head -n1 | awk '{print $1"/"$2}')"
|
||||
HOMEBREW_USER_AGENT_CURL="$HOMEBREW_USER_AGENT $HOMEBREW_CURL_VERSION"
|
||||
curl_version_output="$("$HOMEBREW_CURL" --version 2>/dev/null)"
|
||||
curl_name_and_version="${curl_version_output%% (*}"
|
||||
HOMEBREW_USER_AGENT_CURL="$HOMEBREW_USER_AGENT ${curl_name_and_version// //}"
|
||||
|
||||
# Declared in bin/brew
|
||||
export HOMEBREW_BREW_FILE
|
||||
@ -172,6 +199,7 @@ export HOMEBREW_SYSTEM
|
||||
export HOMEBREW_CURL
|
||||
export HOMEBREW_SYSTEM_CURL_TOO_OLD
|
||||
export HOMEBREW_GIT
|
||||
export HOMEBREW_MINIMUM_GIT_VERSION
|
||||
export HOMEBREW_PROCESSOR
|
||||
export HOMEBREW_PRODUCT
|
||||
export HOMEBREW_OS_VERSION
|
||||
|
||||
@ -489,8 +489,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def check_git_version
|
||||
# System Git version on macOS Sierra.
|
||||
minimum_version = "2.14.3".freeze
|
||||
minimum_version = ENV["HOMEBREW_MINIMUM_GIT_VERSION"].freeze
|
||||
return unless Utils.git_available?
|
||||
return if Version.create(Utils.git_version) >= Version.create(minimum_version)
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
# When done, regenerate the man page and its HTML version by running `brew man`.
|
||||
%>
|
||||
brew(1) -- The missing package manager for macOS
|
||||
===============================================
|
||||
================================================
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
@ -105,6 +105,7 @@ can take several different forms:
|
||||
The formula file will be cached for later use.
|
||||
|
||||
## ENVIRONMENT
|
||||
|
||||
Note that environment variables must have a value set to be detected. For example, `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just `export HOMEBREW_NO_INSECURE_REDIRECT`.
|
||||
|
||||
* `HOMEBREW_ARTIFACT_DOMAIN`:
|
||||
@ -180,22 +181,16 @@ Note that environment variables must have a value set to be detected. For exampl
|
||||
editors will do strange things in this case.
|
||||
|
||||
* `HOMEBREW_FORCE_BREWED_CURL`:
|
||||
If set, Homebrew will use a Homebrew-installed `curl` rather than the
|
||||
system version.
|
||||
If set, Homebrew will always use a Homebrew-installed `curl` rather than the
|
||||
system version. Automatically set if the system version of `curl` is too old.
|
||||
|
||||
* `HOMEBREW_FORCE_VENDOR_RUBY`:
|
||||
If set, Homebrew will always use its vendored, relocatable Ruby version
|
||||
even if the system version of Ruby is new enough.
|
||||
|
||||
* `HOMEBREW_GIT`:
|
||||
When using Git, Homebrew will use `GIT` if set,
|
||||
a Homebrew-built Git if installed, or the system-provided binary.
|
||||
|
||||
Set this to force Homebrew to use a particular git binary.
|
||||
|
||||
* `HOMEBREW_FORCE_BREWED_GIT`:
|
||||
If set, Homebrew will use a Homebrew-installed `git` rather than the
|
||||
system version.
|
||||
If set, Homebrew will always use a Homebrew-installed `git` rather than the
|
||||
system version. Automatically set if the system version of `git` is too old.
|
||||
|
||||
* `HOMEBREW_GITHUB_API_TOKEN`:
|
||||
A personal access token for the GitHub API, which you can create at
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script because we support $GIT, $HOMEBREW_SVN, etc., Xcode-only and
|
||||
# This script because we support $HOMEBREW_GIT, $HOMEBREW_SVN, etc., Xcode-only and
|
||||
# no Xcode/CLT configurations. Order is careful to be what the user would want.
|
||||
|
||||
set +o posix
|
||||
|
||||
@ -123,7 +123,6 @@ class SystemConfig
|
||||
HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew",
|
||||
HOMEBREW_TEMP: ENV["HOMEBREW_SYSTEM_TEMP"],
|
||||
HOMEBREW_RUBY_WARNINGS: "-W0",
|
||||
HOMEBREW_GIT: "git",
|
||||
}.freeze
|
||||
boring_keys = %w[
|
||||
HOMEBREW_BROWSER
|
||||
@ -137,10 +136,12 @@ class SystemConfig
|
||||
HOMEBREW_BREW_FILE
|
||||
HOMEBREW_COMMAND_DEPTH
|
||||
HOMEBREW_CURL
|
||||
HOMEBREW_GIT
|
||||
HOMEBREW_GIT_CONFIG_FILE
|
||||
HOMEBREW_LIBRARY
|
||||
HOMEBREW_MACOS_VERSION
|
||||
HOMEBREW_MACOS_VERSION_NUMERIC
|
||||
HOMEBREW_MINIMUM_GIT_VERSION
|
||||
HOMEBREW_RUBY_PATH
|
||||
HOMEBREW_SYSTEM
|
||||
HOMEBREW_SYSTEM_TEMP
|
||||
@ -168,9 +169,6 @@ class SystemConfig
|
||||
if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s
|
||||
f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}"
|
||||
end
|
||||
if defaults_hash[:HOMEBREW_GIT] != ENV["HOMEBREW_GIT"].to_s
|
||||
f.puts "HOMEBREW_GIT: #{ENV["HOMEBREW_GIT"]}"
|
||||
end
|
||||
unless ENV["HOMEBREW_ENV"]
|
||||
ENV.sort.each do |key, value|
|
||||
next unless key.start_with?("HOMEBREW_")
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
brew(1) -- The missing package manager for macOS
|
||||
===============================================
|
||||
================================================
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
@ -1100,6 +1100,7 @@ can take several different forms:
|
||||
The formula file will be cached for later use.
|
||||
|
||||
## ENVIRONMENT
|
||||
|
||||
Note that environment variables must have a value set to be detected. For example, `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just `export HOMEBREW_NO_INSECURE_REDIRECT`.
|
||||
|
||||
* `HOMEBREW_ARTIFACT_DOMAIN`:
|
||||
@ -1175,22 +1176,16 @@ Note that environment variables must have a value set to be detected. For exampl
|
||||
editors will do strange things in this case.
|
||||
|
||||
* `HOMEBREW_FORCE_BREWED_CURL`:
|
||||
If set, Homebrew will use a Homebrew-installed `curl` rather than the
|
||||
system version.
|
||||
If set, Homebrew will always use a Homebrew-installed `curl` rather than the
|
||||
system version. Automatically set if the system version of `curl` is too old.
|
||||
|
||||
* `HOMEBREW_FORCE_VENDOR_RUBY`:
|
||||
If set, Homebrew will always use its vendored, relocatable Ruby version
|
||||
even if the system version of Ruby is new enough.
|
||||
|
||||
* `HOMEBREW_GIT`:
|
||||
When using Git, Homebrew will use `GIT` if set,
|
||||
a Homebrew-built Git if installed, or the system-provided binary.
|
||||
|
||||
Set this to force Homebrew to use a particular git binary.
|
||||
|
||||
* `HOMEBREW_FORCE_BREWED_GIT`:
|
||||
If set, Homebrew will use a Homebrew-installed `git` rather than the
|
||||
system version.
|
||||
If set, Homebrew will always use a Homebrew-installed `git` rather than the
|
||||
system version. Automatically set if the system version of `git` is too old.
|
||||
|
||||
* `HOMEBREW_GITHUB_API_TOKEN`:
|
||||
A personal access token for the GitHub API, which you can create at
|
||||
|
||||
@ -1297,22 +1297,15 @@ If set, Homebrew will use this editor when editing a single formula, or several
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_FORCE_BREWED_CURL\fR
|
||||
If set, Homebrew will use a Homebrew\-installed \fBcurl\fR rather than the system version\.
|
||||
If set, Homebrew will always use a Homebrew\-installed \fBcurl\fR rather than the system version\. Automatically set if the system version of \fBcurl\fR is too old\.
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_FORCE_VENDOR_RUBY\fR
|
||||
If set, Homebrew will always use its vendored, relocatable Ruby version even if the system version of Ruby is new enough\.
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_GIT\fR
|
||||
When using Git, Homebrew will use \fBGIT\fR if set, a Homebrew\-built Git if installed, or the system\-provided binary\.
|
||||
.
|
||||
.IP
|
||||
Set this to force Homebrew to use a particular git binary\.
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_FORCE_BREWED_GIT\fR
|
||||
If set, Homebrew will use a Homebrew\-installed \fBgit\fR rather than the system version\.
|
||||
If set, Homebrew will always use a Homebrew\-installed \fBgit\fR rather than the system version\. Automatically set if the system version of \fBgit\fR is too old\.
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_GITHUB_API_TOKEN\fR
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user