From 1408b5ffd4dfbac840580ea9946237d8164941d8 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Tue, 30 Aug 2016 03:54:24 +0100 Subject: [PATCH 1/3] diagnostic: add strict_development_tools_checks --- Library/Homebrew/extend/os/mac/diagnostic.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 120e5d15cf..11d497d608 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -12,6 +12,13 @@ module Homebrew ] end + def strict_development_tools_checks + %w[ + check_xcode_up_to_date + check_clt_up_to_date + ] + end + def check_for_unsupported_osx return if ARGV.homebrew_developer? @@ -51,10 +58,17 @@ module Homebrew def check_xcode_up_to_date return unless MacOS::Xcode.installed? && MacOS::Xcode.outdated? + if OS::Mac.prerelease? + xcode_select_nudge = <<-EOS.undent + If #{MacOS::Xcode.latest_version} is installed, you may need to: + sudo xcode-select --switch /path/to/Xcode-beta.app + EOS + end + <<-EOS.undent Your Xcode (#{MacOS::Xcode.version}) is outdated Please update to Xcode #{MacOS::Xcode.latest_version}. - #{MacOS::Xcode.update_instructions} + #{MacOS::Xcode.update_instructions}#{xcode_select_nudge} EOS end From 921aa015760a0b85345efd8fb921537499657872 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Tue, 30 Aug 2016 03:57:07 +0100 Subject: [PATCH 2/3] install: die if Xcode/CLT not up-to-date on prereleases --- Library/Homebrew/cmd/install.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index edf8093bfb..a1df8f459c 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -227,6 +227,12 @@ module Homebrew out = checks.send(check) opoo out unless out.nil? end + if OS.mac? && MacOS.prerelease? + checks.strict_development_tools_checks.each do |strict_check| + out = checks.send(strict_check) + odie out unless out.nil? + end + end end def check_macports From f1cc1265afa43afb9bffba17c9fc18776b62dd99 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Sep 2016 09:11:06 +0100 Subject: [PATCH 3/3] Refactor MacOS check_development_tools usage. Better use the abstraction layer so e.g. Linux could have similarly fatal checks for these things. --- Library/Homebrew/cmd/install.rb | 15 ++++++++------- Library/Homebrew/diagnostic.rb | 7 ++++++- Library/Homebrew/extend/os/mac/diagnostic.rb | 17 +++++++++++------ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index a1df8f459c..074f5fbc3a 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -223,14 +223,15 @@ module Homebrew def check_development_tools checks = Diagnostic::Checks.new - checks.all_development_tools_checks.each do |check| + all_development_tools_checks = checks.development_tools_checks + + checks.fatal_development_tools_checks + all_development_tools_checks.each do |check| out = checks.send(check) - opoo out unless out.nil? - end - if OS.mac? && MacOS.prerelease? - checks.strict_development_tools_checks.each do |strict_check| - out = checks.send(strict_check) - odie out unless out.nil? + next if out.nil? + if checks.fatal_development_tools_checks.include?(check) + odie out + else + opoo out end end end diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 7022987f2d..fed971ad77 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -86,12 +86,17 @@ module Homebrew end ############# END HELPERS - def all_development_tools_checks + def development_tools_checks %w[ check_for_installed_developer_tools ] end + def fatal_development_tools_checks + %w[ + ] + end + def check_for_installed_developer_tools return if DevelopmentTools.installed? diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 11d497d608..27ef71d757 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -1,7 +1,7 @@ module Homebrew module Diagnostic class Checks - def all_development_tools_checks + def development_tools_checks %w[ check_for_unsupported_osx check_for_prerelease_xcode @@ -12,11 +12,16 @@ module Homebrew ] end - def strict_development_tools_checks - %w[ - check_xcode_up_to_date - check_clt_up_to_date - ] + def fatal_development_tools_checks + if MacOS.prerelease? + %w[ + check_xcode_up_to_date + check_clt_up_to_date + ] + else + %w[ + ] + end end def check_for_unsupported_osx