From 4d65b817ec04e8e216f6d371a6f5d691f5677dca Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Tue, 2 Jun 2015 13:07:05 -0400 Subject: Install: remove check_for_bad_install_name_tool Until it can be adapted to not call otool on systems w/o XCode/CLT --- Library/Homebrew/cmd/install.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 7091b9bfc..b2f1f195d 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -122,13 +122,15 @@ module Homebrew end def check_xcode + # TODO: reinstate check_for_bad_install_name_tool + # currently check_for_bad_install_name_tool fails because it tries to call + # the /usr/bin/otool stub program on systems without XCode/CLT checks = Checks.new %w[ check_for_unsupported_osx check_for_installed_developer_tools check_xcode_license_approved check_for_osx_gcc_installer - check_for_bad_install_name_tool ].each do |check| out = checks.send(check) opoo out unless out.nil? -- cgit v1.2.3 From b46d5de49233fde8a89891053a089f96a8749c15 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Tue, 2 Jun 2015 15:47:08 -0400 Subject: Requirements: add CctoolsRequirement Install it as a dependency unless already satisfied by Xcode. require cctools_requirement cctools_requirement should be satisfied by cctools present in opt add build_env => false to the satify block options in CctoolsRequirement --- Library/Homebrew/cmd/install.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index b2f1f195d..fa9507fb3 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -122,13 +122,13 @@ module Homebrew end def check_xcode - # TODO: reinstate check_for_bad_install_name_tool + # TODO: reinstate check_for_bad_install_name_tool and check_for_installed_developer_tools # currently check_for_bad_install_name_tool fails because it tries to call # the /usr/bin/otool stub program on systems without XCode/CLT + # check_for_installed_developer_tools doesn't fail, but produces a warning + # when one is no longer required checks = Checks.new %w[ - check_for_unsupported_osx - check_for_installed_developer_tools check_xcode_license_approved check_for_osx_gcc_installer ].each do |check| -- cgit v1.2.3 From 85187bf6d3779692c77b5ef8a256f16b3048294a Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Sat, 13 Jun 2015 20:32:04 -0400 Subject: MacOS: update locate_cctool This becomes MacOS.{install_name_tool,otool}, only do check_xcode if xcode is installed, otherwise emit a warning --- Library/Homebrew/cmd/install.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index fa9507fb3..1ef1ca61a 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -157,7 +157,12 @@ module Homebrew def perform_preinstall_checks check_ppc check_writable_install_location - check_xcode + if MacOS::Xcode.installed? + check_xcode + else + opoo "You have not installed Xcode." + puts "Bottles may install correctly, but builds will fail!" + end check_cellar end -- cgit v1.2.3 From 91e598cf3f88591f2146218eaa2ecc2a3a261e31 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Mon, 29 Jun 2015 14:09:57 -0400 Subject: 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 --- Library/Homebrew/cmd/install.rb | 18 ++++++++++++------ Library/Homebrew/cmd/reinstall.rb | 8 ++++++++ Library/Homebrew/cmd/upgrade.rb | 8 ++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'Library/Homebrew/cmd') 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? -- cgit v1.2.3 From f58506ea6f7000e7e6d3f6538dc5ff2c43ea7926 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Thu, 23 Jul 2015 00:34:57 -0400 Subject: FormulaInstaller: add prevent_build_flags to eliminate code repetition remove unneeded definition change variable in FormulaInstaller.check_build_flags from bf to build_flags --- Library/Homebrew/cmd/install.rb | 6 +----- Library/Homebrew/cmd/reinstall.rb | 8 +------- Library/Homebrew/cmd/upgrade.rb | 8 +------- 3 files changed, 3 insertions(+), 19 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index ce9bf5291..f41450be1 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -40,11 +40,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 - if !MacOS.can_build? - bf = ARGV.collect_build_flags - - raise BuildFlagsError.new(bf) if !bf.empty? - end + FormulaInstaller.prevent_build_flags unless MacOS.can_build? ARGV.formulae.each do |f| # head-only without --HEAD is an error diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 98941698a..4de1ad9c2 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -2,13 +2,7 @@ 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 + FormulaInstaller.prevent_build_flags unless MacOS.can_build? ARGV.resolved_formulae.each { |f| reinstall_formula(f) } end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index e8fc9c0f8..9bb5d46ad 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -3,13 +3,7 @@ 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 + FormulaInstaller.prevent_build_flags unless MacOS.can_build? Homebrew.perform_preinstall_checks -- cgit v1.2.3 From 1face808f5f1dc43c887cab421b5c01f7e20fdf7 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Sun, 26 Jul 2015 16:49:16 -0400 Subject: Add guards to calls that would trigger Xcode install requests add guard in Formula#file_modified? to prevent git popup add guard in Superenv.bin before calling MacOS::Xcode.version add guard against missing Xcode/CLT in Xcode.uncached_version return nil instread of 0 in uncached_version when Xcode/CLT are not present, to distinguish from linuxbrew behavior checks against pour_bottle? and needs_relocation?, add guard around keg.relocate_install_names to check pour_bottle?/needs_relocation? as well needs_relocation? becomes skip_relocation?, use cellar attr to indicate relocation instead of does_not_need_relocation MacOS.can_build? becomes MacOS.has_apple_developer_tools? --- Library/Homebrew/cmd/config.rb | 10 +++++----- Library/Homebrew/cmd/install.rb | 7 +------ Library/Homebrew/cmd/reinstall.rb | 2 +- Library/Homebrew/cmd/upgrade.rb | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index 7627d6e97..74b4f436e 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -7,23 +7,23 @@ module Homebrew end def llvm - @llvm ||= MacOS.llvm_build_version + @llvm ||= MacOS.llvm_build_version if MacOS.has_apple_developer_tools? end def gcc_42 - @gcc_42 ||= MacOS.gcc_42_build_version + @gcc_42 ||= MacOS.gcc_42_build_version if MacOS.has_apple_developer_tools? end def gcc_40 - @gcc_40 ||= MacOS.gcc_40_build_version + @gcc_40 ||= MacOS.gcc_40_build_version if MacOS.has_apple_developer_tools? end def clang - @clang ||= MacOS.clang_version + @clang ||= MacOS.clang_version if MacOS.has_apple_developer_tools? end def clang_build - @clang_build ||= MacOS.clang_build_version + @clang_build ||= MacOS.clang_build_version if MacOS.has_apple_developer_tools? end def xcode diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index f41450be1..41628b435 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -40,7 +40,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 MacOS.can_build? + FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools? ARGV.formulae.each do |f| # head-only without --HEAD is an error @@ -126,11 +126,6 @@ module Homebrew end def check_xcode - # TODO: reinstate check_for_bad_install_name_tool and check_for_installed_developer_tools - # currently check_for_bad_install_name_tool fails because it tries to call - # the /usr/bin/otool stub program on systems without XCode/CLT - # check_for_installed_developer_tools doesn't fail, but produces a warning - # when one is no longer required checks = Checks.new %w[ check_for_unsupported_osx diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 4de1ad9c2..3c6f9ac20 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -2,7 +2,7 @@ require "formula_installer" module Homebrew def reinstall - FormulaInstaller.prevent_build_flags unless MacOS.can_build? + FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools? ARGV.resolved_formulae.each { |f| reinstall_formula(f) } end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 9bb5d46ad..fb122a659 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -3,7 +3,7 @@ require "cmd/outdated" module Homebrew def upgrade - FormulaInstaller.prevent_build_flags unless MacOS.can_build? + FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools? Homebrew.perform_preinstall_checks -- cgit v1.2.3 From 56795ec1ed4f32d770afb50f65fc7e4e007e42f9 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Sun, 16 Aug 2015 23:41:28 -0400 Subject: Call check_xcode check for CLT, too --- Library/Homebrew/cmd/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 41628b435..28db34daf 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -159,7 +159,7 @@ module Homebrew def perform_preinstall_checks check_ppc check_writable_install_location - check_xcode if MacOS::Xcode.installed? + check_xcode if MacOS.has_apple_developer_tools? check_cellar end -- cgit v1.2.3 From 04a0b2aafe2062701be4028f408d0bee15f3815d Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Thu, 20 Aug 2015 16:34:39 -0400 Subject: Mark TODO in brew doctor (future PR) --- Library/Homebrew/cmd/doctor.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 2a7c7abb1..102c9c2ea 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -257,6 +257,7 @@ class Checks end end + # TODO: distill down into single method definition a la BuildToolsError if MacOS.version >= "10.9" def check_for_installed_developer_tools unless MacOS::Xcode.installed? || MacOS::CLT.installed? then <<-EOS.undent -- cgit v1.2.3