aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorWilliam Woodruff2015-06-29 14:09:57 -0400
committerMisty De Meo2015-08-21 10:59:09 -0700
commit91e598cf3f88591f2146218eaa2ecc2a3a261e31 (patch)
tree09355d2f8889cb8e0302cf91fa5357043701abdd /Library/Homebrew/cmd
parent76dcad7c82247e1c342cecda67fda11555788f0d (diff)
downloadbrew-91e598cf3f88591f2146218eaa2ecc2a3a261e31.tar.bz2
Install: add BuildToolsError and BuildFlagsError
Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/install.rb18
-rw-r--r--Library/Homebrew/cmd/reinstall.rb8
-rw-r--r--Library/Homebrew/cmd/upgrade.rb8
3 files changed, 28 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 1ef1ca61a..ce9bf5291 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -38,6 +38,14 @@ module Homebrew
end
end
+ # if the user's flags will prevent bottle only-installations when no
+ # developer tools are available, we need to stop them early on
+ if !MacOS.can_build?
+ bf = ARGV.collect_build_flags
+
+ raise BuildFlagsError.new(bf) if !bf.empty?
+ end
+
ARGV.formulae.each do |f|
# head-only without --HEAD is an error
if !ARGV.build_head? && f.stable.nil? && f.devel.nil?
@@ -129,6 +137,9 @@ module Homebrew
# when one is no longer required
checks = Checks.new
%w[
+ check_for_unsupported_osx
+ check_for_bad_install_name_tool
+ check_for_installed_developer_tools
check_xcode_license_approved
check_for_osx_gcc_installer
].each do |check|
@@ -157,12 +168,7 @@ module Homebrew
def perform_preinstall_checks
check_ppc
check_writable_install_location
- if MacOS::Xcode.installed?
- check_xcode
- else
- opoo "You have not installed Xcode."
- puts "Bottles may install correctly, but builds will fail!"
- end
+ check_xcode if MacOS::Xcode.installed?
check_cellar
end
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index bf49282ae..98941698a 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -2,6 +2,14 @@ require "formula_installer"
module Homebrew
def reinstall
+ if !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) }
end
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 8ae231002..e8fc9c0f8 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -3,6 +3,14 @@ require "cmd/outdated"
module Homebrew
def upgrade
+ if !MacOS.can_build?
+ bf = ARGV.collect_build_flags
+
+ if !bf.empty?
+ raise BuildFlagsError.new(bf)
+ end
+ end
+
Homebrew.perform_preinstall_checks
if ARGV.named.empty?