Merge pull request #9064 from MikeMcQuaid/force-bottle
formula_installer: improve --force-bottle behaviour.
This commit is contained in:
commit
ebe5a83b1e
@ -105,10 +105,6 @@ class Formula
|
|||||||
# @private
|
# @private
|
||||||
attr_reader :tap
|
attr_reader :tap
|
||||||
|
|
||||||
# Whether or not to force the use of a bottle.
|
|
||||||
# @private
|
|
||||||
attr_reader :force_bottle
|
|
||||||
|
|
||||||
# The stable (and default) {SoftwareSpec} for this {Formula}.
|
# The stable (and default) {SoftwareSpec} for this {Formula}.
|
||||||
# This contains all the attributes (e.g. URL, checksum) that apply to the
|
# This contains all the attributes (e.g. URL, checksum) that apply to the
|
||||||
# stable version of this formula.
|
# stable version of this formula.
|
||||||
@ -187,6 +183,11 @@ class Formula
|
|||||||
|
|
||||||
alias follow_installed_alias? follow_installed_alias
|
alias follow_installed_alias? follow_installed_alias
|
||||||
|
|
||||||
|
# Whether or not to force the use of a bottle.
|
||||||
|
# @return [Boolean]
|
||||||
|
# @private
|
||||||
|
attr_accessor :force_bottle
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def initialize(name, path, spec, alias_path: nil, force_bottle: false)
|
def initialize(name, path, spec, alias_path: nil, force_bottle: false)
|
||||||
@name = name
|
@name = name
|
||||||
|
@ -70,7 +70,8 @@ class FormulaInstaller
|
|||||||
@build_from_source_formulae = build_from_source_formulae
|
@build_from_source_formulae = build_from_source_formulae
|
||||||
@build_bottle = false
|
@build_bottle = false
|
||||||
@bottle_arch = nil
|
@bottle_arch = nil
|
||||||
@force_bottle = force_bottle
|
@formula.force_bottle ||= force_bottle
|
||||||
|
@force_bottle = @formula.force_bottle
|
||||||
@include_test_formulae = include_test_formulae
|
@include_test_formulae = include_test_formulae
|
||||||
@interactive = false
|
@interactive = false
|
||||||
@git = false
|
@git = false
|
||||||
@ -205,6 +206,10 @@ class FormulaInstaller
|
|||||||
def check_install_sanity
|
def check_install_sanity
|
||||||
raise FormulaInstallationAlreadyAttemptedError, formula if self.class.attempted.include?(formula)
|
raise FormulaInstallationAlreadyAttemptedError, formula if self.class.attempted.include?(formula)
|
||||||
|
|
||||||
|
if force_bottle? && !pour_bottle?
|
||||||
|
raise CannotInstallFormulaError, "--force-bottle passed but #{formula.full_name} has no bottle!"
|
||||||
|
end
|
||||||
|
|
||||||
type, reason = DeprecateDisable.deprecate_disable_info formula
|
type, reason = DeprecateDisable.deprecate_disable_info formula
|
||||||
|
|
||||||
if type.present?
|
if type.present?
|
||||||
@ -217,10 +222,10 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
when :disabled
|
when :disabled
|
||||||
if reason.present?
|
if reason.present?
|
||||||
odie "#{formula.full_name} has been disabled because it #{reason}!"
|
raise CannotInstallFormulaError, "#{formula.full_name} has been disabled because it #{reason}!"
|
||||||
else
|
|
||||||
odie "#{formula.full_name} has been disabled!"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
raise CannotInstallFormulaError, "#{formula.full_name} has been disabled!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -328,7 +333,7 @@ class FormulaInstaller
|
|||||||
return if only_deps?
|
return if only_deps?
|
||||||
|
|
||||||
if build_bottle? && (arch = bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch.to_sym)
|
if build_bottle? && (arch = bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch.to_sym)
|
||||||
raise "Unrecognized architecture for --bottle-arch: #{arch}"
|
raise CannotInstallFormulaError, "Unrecognized architecture for --bottle-arch: #{arch}"
|
||||||
end
|
end
|
||||||
|
|
||||||
formula.deprecated_flags.each do |deprecated_option|
|
formula.deprecated_flags.each do |deprecated_option|
|
||||||
@ -367,6 +372,7 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
raise if Homebrew::EnvConfig.developer? ||
|
raise if Homebrew::EnvConfig.developer? ||
|
||||||
Homebrew::EnvConfig.no_bottle_source_fallback? ||
|
Homebrew::EnvConfig.no_bottle_source_fallback? ||
|
||||||
|
force_bottle? ||
|
||||||
e.is_a?(Interrupt)
|
e.is_a?(Interrupt)
|
||||||
|
|
||||||
@pour_failed = true
|
@pour_failed = true
|
||||||
@ -1035,6 +1041,7 @@ class FormulaInstaller
|
|||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
raise if Homebrew::EnvConfig.developer? ||
|
raise if Homebrew::EnvConfig.developer? ||
|
||||||
Homebrew::EnvConfig.no_bottle_source_fallback? ||
|
Homebrew::EnvConfig.no_bottle_source_fallback? ||
|
||||||
|
force_bottle? ||
|
||||||
e.is_a?(Interrupt)
|
e.is_a?(Interrupt)
|
||||||
|
|
||||||
@pour_failed = true
|
@pour_failed = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user