Merge pull request #10640 from MikeMcQuaid/bottle_source_fallback_default

Make HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK default
This commit is contained in:
Mike McQuaid 2021-02-18 17:42:25 +00:00 committed by GitHub
commit 3929abcd04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 61 deletions

View File

@ -212,11 +212,6 @@ module Homebrew
description: "If set, do not use Bootsnap to speed up repeated `brew` calls.", description: "If set, do not use Bootsnap to speed up repeated `brew` calls.",
boolean: true, boolean: true,
}, },
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: {
description: "If set, fail on the failure of installation from a bottle rather than " \
"falling back to building from source.",
boolean: true,
},
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: { HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: {
description: "If set, do not check for broken dependents after installing, upgrading or reinstalling " \ description: "If set, do not check for broken dependents after installing, upgrading or reinstalling " \
"formulae.", "formulae.",

View File

@ -94,7 +94,6 @@ class FormulaInstaller
@options = options @options = options
@requirement_messages = [] @requirement_messages = []
@poured_bottle = false @poured_bottle = false
@pour_failed = false
@start_time = nil @start_time = nil
end end
@ -154,8 +153,6 @@ class FormulaInstaller
sig { params(output_warning: T::Boolean).returns(T::Boolean) } sig { params(output_warning: T::Boolean).returns(T::Boolean) }
def pour_bottle?(output_warning: false) def pour_bottle?(output_warning: false)
return false if @pour_failed
return false if !formula.bottle_tag? && !formula.local_bottle_path return false if !formula.bottle_tag? && !formula.local_bottle_path
return true if force_bottle? return true if force_bottle?
return false if build_from_source? || build_bottle? || interactive? return false if build_from_source? || build_bottle? || interactive?
@ -235,8 +232,7 @@ class FormulaInstaller
# homebrew-core and have full bottle coverage. # homebrew-core and have full bottle coverage.
(OS.mac? || ENV["CI"]) && (OS.mac? || ENV["CI"]) &&
!build_from_source? && !build_bottle? && !build_from_source? && !build_bottle? &&
!installed_as_dependency? && formula.tap&.core_tap? && !formula.bottle_unneeded? &&
formula.tap&.core_tap? && !formula.bottle_unneeded? && !formula.any_version_installed? &&
# Integration tests override homebrew-core locations # Integration tests override homebrew-core locations
ENV["HOMEBREW_TEST_TMPDIR"].nil? && ENV["HOMEBREW_TEST_TMPDIR"].nil? &&
!pour_bottle? !pour_bottle?
@ -244,21 +240,29 @@ class FormulaInstaller
formula_message = formula.pour_bottle_check_unsatisfied_reason formula_message = formula.pour_bottle_check_unsatisfied_reason
formula_message[0] = formula_message[0].downcase formula_message[0] = formula_message[0].downcase
"#{formula}: #{formula_message}" <<~EOS
else #{formula}: #{formula_message}
EOS
# don't want to complain about no bottle available if doing an
# upgrade/reinstall/dependency install (but do in the case the bottle
# check fails)
elsif !installed_as_dependency? && !formula.any_version_installed?
<<~EOS <<~EOS
#{formula}: no bottle available! #{formula}: no bottle available!
EOS EOS
end end
message += <<~EOS
You can try to install from source with: if message
brew install --build-from-source #{formula} message += <<~EOS
Please note building from source is unsupported. You will encounter build You can try to install from source with:
failures with some formulae. If you experience any issues please create pull brew install --build-from-source #{formula}
requests instead of asking for help on Homebrew's GitHub, Twitter or any other Please note building from source is unsupported. You will encounter build
official channels. failures with some formulae. If you experience any issues please create pull
EOS requests instead of asking for help on Homebrew's GitHub, Twitter or any other
raise CannotInstallFormulaError, message official channels.
EOS
raise CannotInstallFormulaError, message
end
end end
type, reason = DeprecateDisable.deprecate_disable_info formula type, reason = DeprecateDisable.deprecate_disable_info formula
@ -429,7 +433,7 @@ class FormulaInstaller
if pour_bottle? if pour_bottle?
begin begin
pour pour
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception # rubocop:disable Lint/RescueException
# any exceptions must leave us with nothing installed # any exceptions must leave us with nothing installed
ignore_interrupts do ignore_interrupts do
begin begin
@ -442,17 +446,7 @@ class FormulaInstaller
end end
formula.rack.rmdir_if_possible formula.rack.rmdir_if_possible
end end
raise if Homebrew::EnvConfig.developer? || raise
Homebrew::EnvConfig.no_bottle_source_fallback? ||
force_bottle? ||
e.is_a?(Interrupt)
@pour_failed = true
onoe e.message
opoo "Bottle installation failed: building from source."
raise UnbottledError, [formula] unless DevelopmentTools.installed?
compute_and_install_dependencies unless ignore_deps?
else else
@poured_bottle = true @poured_bottle = true
end end
@ -513,7 +507,7 @@ class FormulaInstaller
$stderr.puts "Please report this issue to the #{formula.tap} tap (not Homebrew/brew or Homebrew/core)!" $stderr.puts "Please report this issue to the #{formula.tap} tap (not Homebrew/brew or Homebrew/core)!"
false false
else # rubocop:disable Layout/ElseAlignment else
f.linked_keg.exist? && f.opt_prefix.exist? f.linked_keg.exist? && f.opt_prefix.exist?
end end
@ -1123,25 +1117,10 @@ class FormulaInstaller
return if only_deps? return if only_deps?
if pour_bottle?(output_warning: true) unless pour_bottle?(output_warning: true)
begin formula.fetch_patches
downloader.fetch formula.resources.each(&:fetch)
rescue Exception => e # rubocop:disable Lint/RescueException
raise if Homebrew::EnvConfig.developer? ||
Homebrew::EnvConfig.no_bottle_source_fallback? ||
force_bottle? ||
e.is_a?(Interrupt)
@pour_failed = true
onoe e.message
opoo "Bottle installation failed: building from source."
fetch_dependencies
end
end end
return if pour_bottle?
formula.fetch_patches
formula.resources.each(&:fetch)
downloader.fetch downloader.fetch
end end

View File

@ -1858,9 +1858,6 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_NO_BOOTSNAP` - `HOMEBREW_NO_BOOTSNAP`
<br>If set, do not use Bootsnap to speed up repeated `brew` calls. <br>If set, do not use Bootsnap to speed up repeated `brew` calls.
- `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`
<br>If set, fail on the failure of installation from a bottle rather than falling back to building from source.
- `HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK` - `HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK`
<br>If set, do not check for broken dependents after installing, upgrading or reinstalling formulae. <br>If set, do not check for broken dependents after installing, upgrading or reinstalling formulae.

View File

@ -2653,12 +2653,6 @@ If set, do not automatically update before running some commands e\.g\. \fBbrew
If set, do not use Bootsnap to speed up repeated \fBbrew\fR calls\. If set, do not use Bootsnap to speed up repeated \fBbrew\fR calls\.
. .
.TP .TP
\fBHOMEBREW_NO_BOTTLE_SOURCE_FALLBACK\fR
.
.br
If set, fail on the failure of installation from a bottle rather than falling back to building from source\.
.
.TP
\fBHOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK\fR \fBHOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK\fR
. .
.br .br