Pass args directly to prevent_build_flags.
This commit is contained in:
parent
36458b2356
commit
c470a6ff43
@ -69,19 +69,6 @@ module Homebrew
|
||||
named.blank?
|
||||
end
|
||||
|
||||
# If the user passes any flags that trigger building over installing from
|
||||
# a bottle, they are collected here and returned as an Array for checking.
|
||||
def collect_build_args
|
||||
build_flags = []
|
||||
|
||||
build_flags << "--HEAD" if HEAD?
|
||||
build_flags << "--universal" if build_universal?
|
||||
build_flags << "--build-bottle" if build_bottle?
|
||||
build_flags << "--build-from-source" if build_from_source?
|
||||
|
||||
build_flags
|
||||
end
|
||||
|
||||
def formulae
|
||||
require "formula"
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ module Homebrew
|
||||
|
||||
# if the user's flags will prevent bottle only-installations when no
|
||||
# developer tools are available, we need to stop them early on
|
||||
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
||||
FormulaInstaller.prevent_build_flags(args)
|
||||
|
||||
args.formulae.each do |f|
|
||||
# head-only without --HEAD is an error
|
||||
|
||||
@ -57,7 +57,7 @@ module Homebrew
|
||||
def reinstall
|
||||
args = reinstall_args.parse
|
||||
|
||||
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
||||
FormulaInstaller.prevent_build_flags(args)
|
||||
|
||||
Install.perform_preinstall_checks
|
||||
|
||||
|
||||
@ -70,12 +70,12 @@ module Homebrew
|
||||
named_formulae_specified = !formulae.empty? && casks.empty?
|
||||
named_casks_specified = !casks.empty? && formulae.empty?
|
||||
|
||||
upgrade_outdated_formulae(formulae) unless named_casks_specified
|
||||
upgrade_outdated_formulae(formulae, args: args) unless named_casks_specified
|
||||
upgrade_outdated_casks(casks) unless named_formulae_specified
|
||||
end
|
||||
|
||||
def upgrade_outdated_formulae(formulae)
|
||||
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
||||
def upgrade_outdated_formulae(formulae, args:)
|
||||
FormulaInstaller.prevent_build_flags(args)
|
||||
|
||||
Install.perform_preinstall_checks
|
||||
|
||||
|
||||
@ -95,10 +95,18 @@ class FormulaInstaller
|
||||
|
||||
# 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 invoked when the user has no developer tools.
|
||||
def self.prevent_build_flags
|
||||
build_flags = args&.collect_build_args
|
||||
return if build_flags.blank?
|
||||
# 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.formulae.all?(&:bottled?)
|
||||
raise BuildFlagsError.new(build_flags, bottled: all_bottled)
|
||||
@ -475,7 +483,7 @@ class FormulaInstaller
|
||||
|
||||
if req.prune_from_option?(build)
|
||||
Requirement.prune
|
||||
elsif req.satisfied?(args: Homebrew.args)
|
||||
elsif req.satisfied?(args: args)
|
||||
Requirement.prune
|
||||
elsif (req.build? || req.test?) && !keep_build_test
|
||||
Requirement.prune
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user