FormulaInstaller: add prevent_build_flags to eliminate code repetition
remove unneeded definition change variable in FormulaInstaller.check_build_flags from bf to build_flags
This commit is contained in:
parent
91e598cf3f
commit
f58506ea6f
@ -40,11 +40,7 @@ module Homebrew
|
|||||||
|
|
||||||
# if the user's flags will prevent bottle only-installations when no
|
# if the user's flags will prevent bottle only-installations when no
|
||||||
# developer tools are available, we need to stop them early on
|
# developer tools are available, we need to stop them early on
|
||||||
if !MacOS.can_build?
|
FormulaInstaller.prevent_build_flags unless MacOS.can_build?
|
||||||
bf = ARGV.collect_build_flags
|
|
||||||
|
|
||||||
raise BuildFlagsError.new(bf) if !bf.empty?
|
|
||||||
end
|
|
||||||
|
|
||||||
ARGV.formulae.each do |f|
|
ARGV.formulae.each do |f|
|
||||||
# head-only without --HEAD is an error
|
# head-only without --HEAD is an error
|
||||||
|
@ -2,13 +2,7 @@ require "formula_installer"
|
|||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def reinstall
|
def reinstall
|
||||||
if !MacOS.can_build?
|
FormulaInstaller.prevent_build_flags unless MacOS.can_build?
|
||||||
bf = ARGV.collect_build_flags
|
|
||||||
|
|
||||||
if !bf.empty?
|
|
||||||
raise BuildFlagsError.new(bf)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
ARGV.resolved_formulae.each { |f| reinstall_formula(f) }
|
ARGV.resolved_formulae.each { |f| reinstall_formula(f) }
|
||||||
end
|
end
|
||||||
|
@ -3,13 +3,7 @@ require "cmd/outdated"
|
|||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def upgrade
|
def upgrade
|
||||||
if !MacOS.can_build?
|
FormulaInstaller.prevent_build_flags unless MacOS.can_build?
|
||||||
bf = ARGV.collect_build_flags
|
|
||||||
|
|
||||||
if !bf.empty?
|
|
||||||
raise BuildFlagsError.new(bf)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Homebrew.perform_preinstall_checks
|
Homebrew.perform_preinstall_checks
|
||||||
|
|
||||||
|
@ -56,6 +56,13 @@ class FormulaInstaller
|
|||||||
@pour_failed = false
|
@pour_failed = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# called by install/reinstall/upgrade when no build tools are available
|
||||||
|
def self.prevent_build_flags
|
||||||
|
build_flags = ARGV.collect_build_flags
|
||||||
|
|
||||||
|
raise BuildFlagsError.new(build_flags) unless build_flags.empty?
|
||||||
|
end
|
||||||
|
|
||||||
def pour_bottle?(install_bottle_options = { :warn=>false })
|
def pour_bottle?(install_bottle_options = { :warn=>false })
|
||||||
return true if Homebrew::Hooks::Bottles.formula_has_bottle?(formula)
|
return true if Homebrew::Hooks::Bottles.formula_has_bottle?(formula)
|
||||||
|
|
||||||
@ -234,8 +241,6 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_dependencies_bottled(deps)
|
def check_dependencies_bottled(deps)
|
||||||
unbottled = []
|
|
||||||
|
|
||||||
unbottled = deps.select do |dep, _|
|
unbottled = deps.select do |dep, _|
|
||||||
formula = dep.to_formula
|
formula = dep.to_formula
|
||||||
!formula.pour_bottle? && !MacOS.can_build?
|
!formula.pour_bottle? && !MacOS.can_build?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user