Remove FormulaInstaller.prevent_build_flags
This commit is contained in:
parent
a235b38000
commit
d14a0bb131
@ -176,7 +176,15 @@ 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
|
||||||
FormulaInstaller.prevent_build_flags(args)
|
unless DevelopmentTools.installed?
|
||||||
|
build_flags = []
|
||||||
|
|
||||||
|
build_flags << "--HEAD" if args.HEAD?
|
||||||
|
build_flags << "--build-bottle" if args.build_bottle?
|
||||||
|
build_flags << "--build-from-source" if args.build_from_source?
|
||||||
|
|
||||||
|
raise BuildFlagsError.new(build_flags, bottled: formulae.all?(&:bottled?)) if build_flags.present?
|
||||||
|
end
|
||||||
|
|
||||||
installed_formulae = []
|
installed_formulae = []
|
||||||
|
|
||||||
|
|||||||
@ -81,13 +81,15 @@ module Homebrew
|
|||||||
def reinstall
|
def reinstall
|
||||||
args = reinstall_args.parse
|
args = reinstall_args.parse
|
||||||
|
|
||||||
FormulaInstaller.prevent_build_flags(args)
|
|
||||||
|
|
||||||
Install.perform_preinstall_checks
|
|
||||||
|
|
||||||
formulae, casks = args.named.to_formulae_and_casks(method: :resolve)
|
formulae, casks = args.named.to_formulae_and_casks(method: :resolve)
|
||||||
.partition { |o| o.is_a?(Formula) }
|
.partition { |o| o.is_a?(Formula) }
|
||||||
|
|
||||||
|
if args.build_from_source? && !DevelopmentTools.installed?
|
||||||
|
raise BuildFlagsError.new(["--build-from-source"], bottled: formulae.all?(&:bottled?))
|
||||||
|
end
|
||||||
|
|
||||||
|
Install.perform_preinstall_checks
|
||||||
|
|
||||||
formulae.each do |formula|
|
formulae.each do |formula|
|
||||||
if formula.pinned?
|
if formula.pinned?
|
||||||
onoe "#{formula.full_name} is pinned. You must unpin it to reinstall."
|
onoe "#{formula.full_name} is pinned. You must unpin it to reinstall."
|
||||||
|
|||||||
@ -115,7 +115,9 @@ module Homebrew
|
|||||||
def upgrade_outdated_formulae(formulae, args:)
|
def upgrade_outdated_formulae(formulae, args:)
|
||||||
return false if args.cask?
|
return false if args.cask?
|
||||||
|
|
||||||
FormulaInstaller.prevent_build_flags(args)
|
if args.build_from_source? && !DevelopmentTools.installed?
|
||||||
|
raise BuildFlagsError.new(["--build-from-source"], bottled: formulae.all?(&:bottled?))
|
||||||
|
end
|
||||||
|
|
||||||
Install.perform_preinstall_checks
|
Install.perform_preinstall_checks
|
||||||
|
|
||||||
|
|||||||
@ -115,25 +115,6 @@ class FormulaInstaller
|
|||||||
@installed = Set.new
|
@installed = Set.new
|
||||||
end
|
end
|
||||||
|
|
||||||
# When no build tools are available and build flags are passed through ARGV,
|
|
||||||
# it's necessary to interrupt the user before any sort of installation
|
|
||||||
# can proceed. Only raises when the user has no developer tools.
|
|
||||||
def self.prevent_build_flags(args)
|
|
||||||
return if DevelopmentTools.installed?
|
|
||||||
|
|
||||||
build_flags = []
|
|
||||||
|
|
||||||
build_flags << "--HEAD" if args.HEAD?
|
|
||||||
build_flags << "--universal" if args.universal?
|
|
||||||
build_flags << "--build-bottle" if args.build_bottle?
|
|
||||||
build_flags << "--build-from-source" if args.build_from_source?
|
|
||||||
|
|
||||||
return if build_flags.empty?
|
|
||||||
|
|
||||||
all_bottled = args.named.to_formulae.all?(&:bottled?)
|
|
||||||
raise BuildFlagsError.new(build_flags, bottled: all_bottled)
|
|
||||||
end
|
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def build_from_source?
|
def build_from_source?
|
||||||
@build_from_source_formulae.include?(formula.full_name)
|
@build_from_source_formulae.include?(formula.full_name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user