Change Mojave bottle behaviour

Rather than relying on a `HOMEBREW_FORCE_BOTTLE` variable (which ends
up doing silly things like forcing bottle usage even when options are
provided) instead handle this at the `or_later` bottle detection
level so on prerelease versions of macOS any bottle looks like an
`or_later` bottle (unless various environment variables are set).

Fixes issues noted in:
https://github.com/Homebrew/brew/pull/4520#issuecomment-407229605
This commit is contained in:
Mike McQuaid 2018-07-24 09:20:50 +01:00
parent 758aefaa27
commit 6417332a3a
6 changed files with 13 additions and 26 deletions

View File

@ -262,14 +262,6 @@ then
# Don't allow non-developers to customise Ruby warnings.
unset HOMEBREW_RUBY_WARNINGS
# Default non-developers to bottles on prerelease versions of macOS
# in default prefix.
if [[ "$HOMEBREW_PREFIX" = "/usr/local" &&
"$HOMEBREW_MACOS_VERSION_NUMERIC" -ge "101400" ]]
then
export HOMEBREW_FORCE_BOTTLE="1"
fi
fi
if [[ -z "$HOMEBREW_RUBY_WARNINGS" ]]

View File

@ -262,8 +262,7 @@ module HomebrewArgvExtension
end
def force_bottle?
return false if ENV["HOMEBREW_NO_FORCE_BOTTLE"]
include?("--force-bottle") || !ENV["HOMEBREW_FORCE_BOTTLE"].nil?
include?("--force-bottle")
end
def fetch_head?

View File

@ -54,8 +54,20 @@ module Utils
MacOS::Version.from_symbol(later_tag) <= tag_version
elsif ARGV.force_bottle?
true
end
end
# Allow prerelease versions to act as if all bottles are `_or_later`
# so that they don't need to wait for us to bottle everything for the
# new release.
elsif install_older_prerelease_bottles?
true
end
end
end
def install_older_prerelease_bottles?
return false unless OS::Mac.prerelease?
return true if ENV["HOMEBREW_INSTALL_OLDER_PRERELEASE_BOTTLES"]
return false if ENV["HOMEBREW_NO_INSTALL_OLDER_PRERELEASE_BOTTLES"]
!ARGV.homebrew_developer?
end
end
end

View File

@ -170,12 +170,6 @@ Note that environment variables must have a value set to be detected. For exampl
directories. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case.
* `HOMEBREW_FORCE_BOTTLE`:
If set, Homebrew will install from a bottle if it exists for the
current or newest version of macOS, even if it would not normally be used
for installation. Please do not file issues if you encounter errors when
using this environment variable.
* `HOMEBREW_FORCE_BREWED_CURL`:
If set, Homebrew will use a Homebrew-installed `curl` rather than the
system version.

View File

@ -1170,12 +1170,6 @@ Note that environment variables must have a value set to be detected. For exampl
directories. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case.
* `HOMEBREW_FORCE_BOTTLE`:
If set, Homebrew will install from a bottle if it exists for the
current or newest version of macOS, even if it would not normally be used
for installation. Please do not file issues if you encounter errors when
using this environment variable.
* `HOMEBREW_FORCE_BREWED_CURL`:
If set, Homebrew will use a Homebrew-installed `curl` rather than the
system version.

View File

@ -1112,10 +1112,6 @@ If set, Homebrew will use this editor when editing a single formula, or several
\fINote:\fR \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. TextMate can handle this correctly in project mode, but many editors will do strange things in this case\.
.
.TP
\fBHOMEBREW_FORCE_BOTTLE\fR
If set, Homebrew will install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. Please do not file issues if you encounter errors when using this environment variable\.
.
.TP
\fBHOMEBREW_FORCE_BREWED_CURL\fR
If set, Homebrew will use a Homebrew\-installed \fBcurl\fR rather than the system version\.
.