Move head-only checks to cmd/install

Fixes Homebrew/homebrew#30084.
Closes Homebrew/homebrew#30203.
This commit is contained in:
Jack Nagel 2014-06-16 13:38:14 -05:00
parent 9d030f8397
commit c6d75bfcec
2 changed files with 15 additions and 13 deletions

View File

@ -24,6 +24,21 @@ module Homebrew extend self
end end
end unless ARGV.force? end unless ARGV.force?
ARGV.formulae.each do |f|
# Building head-only without --HEAD is an error
if not ARGV.build_head? and f.stable.nil?
raise CannotInstallFormulaError, <<-EOS.undent
#{f} is a head-only formula
Install with `brew install --HEAD #{f.name}`
EOS
end
# Building stable-only with --HEAD is an error
if ARGV.build_head? and f.head.nil?
raise CannotInstallFormulaError, "No head is defined for #{f.name}"
end
end
perform_preinstall_checks perform_preinstall_checks
begin begin

View File

@ -109,19 +109,6 @@ class FormulaInstaller
raise FormulaAlreadyInstalledError, msg raise FormulaAlreadyInstalledError, msg
end end
# Building head-only without --HEAD is an error
if not ARGV.build_head? and f.stable.nil?
raise CannotInstallFormulaError, <<-EOS.undent
#{f} is a head-only formula
Install with `brew install --HEAD #{f.name}
EOS
end
# Building stable-only with --HEAD is an error
if ARGV.build_head? and f.head.nil?
raise CannotInstallFormulaError, "No head is defined for #{f.name}"
end
unless ignore_deps? unless ignore_deps?
unlinked_deps = f.recursive_dependencies.map(&:to_formula).select do |dep| unlinked_deps = f.recursive_dependencies.map(&:to_formula).select do |dep|
dep.installed? and not dep.keg_only? and not dep.linked_keg.directory? dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?