Separate Xcode and CLT doctor checks by OS X version
Closes Homebrew/homebrew#29206.
This commit is contained in:
		
							parent
							
								
									be6029c634
								
							
						
					
					
						commit
						1845b39d41
					
				@ -198,74 +198,82 @@ def check_for_broken_symlinks
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check_xcode_clt
 | 
					if MacOS.version >= "10.9"
 | 
				
			||||||
  if MacOS.version >= :mavericks
 | 
					  def check_for_installed_developer_tools
 | 
				
			||||||
    __check_clt_up_to_date
 | 
					    unless MacOS::CLT.installed? then <<-EOS.undent
 | 
				
			||||||
  elsif MacOS::Xcode.installed?
 | 
					      No developer tools installed.
 | 
				
			||||||
    __check_xcode_up_to_date
 | 
					      Install the Command Line Tools:
 | 
				
			||||||
  elsif MacOS.version >= :lion
 | 
					        xcode-select --install
 | 
				
			||||||
    __check_clt_up_to_date
 | 
					 | 
				
			||||||
  else <<-EOS.undent
 | 
					 | 
				
			||||||
      Xcode is not installed
 | 
					 | 
				
			||||||
      Most formulae need Xcode to build.
 | 
					 | 
				
			||||||
      It can be installed from https://developer.apple.com/downloads/
 | 
					 | 
				
			||||||
      EOS
 | 
					      EOS
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def __check_xcode_up_to_date
 | 
					  def check_xcode_up_to_date
 | 
				
			||||||
  if MacOS::Xcode.outdated?
 | 
					    if MacOS::Xcode.installed? && MacOS::Xcode.outdated? then <<-EOS.undent
 | 
				
			||||||
    message = <<-EOS.undent
 | 
					 | 
				
			||||||
      Your Xcode (#{MacOS::Xcode.version}) is outdated
 | 
					      Your Xcode (#{MacOS::Xcode.version}) is outdated
 | 
				
			||||||
      Please update to Xcode #{MacOS::Xcode.latest_version}.
 | 
					      Please update to Xcode #{MacOS::Xcode.latest_version}.
 | 
				
			||||||
    EOS
 | 
					 | 
				
			||||||
    if MacOS.version >= :lion
 | 
					 | 
				
			||||||
      message += <<-EOS.undent
 | 
					 | 
				
			||||||
      Xcode can be updated from the App Store.
 | 
					      Xcode can be updated from the App Store.
 | 
				
			||||||
      EOS
 | 
					      EOS
 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      message += <<-EOS.undent
 | 
					 | 
				
			||||||
      Xcode can be updated from https://developer.apple.com/downloads/
 | 
					 | 
				
			||||||
      EOS
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
    message
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def __check_clt_up_to_date
 | 
					  def check_clt_up_to_date
 | 
				
			||||||
  if not MacOS::CLT.installed?
 | 
					    if MacOS::CLT.installed? && MacOS::CLT.outdated? then <<-EOS.undent
 | 
				
			||||||
    message = <<-EOS.undent
 | 
					      A newer Command Line Tools release is available.
 | 
				
			||||||
 | 
					      Update them from Software Update in the App Store.
 | 
				
			||||||
 | 
					      EOS
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					elsif MacOS.version == "10.8" || MacOS.version == "10.7"
 | 
				
			||||||
 | 
					  def check_for_installed_developer_tools
 | 
				
			||||||
 | 
					    unless MacOS::Xcode.installed? || MacOS::CLT.installed? then <<-EOS.undent
 | 
				
			||||||
      No developer tools installed.
 | 
					      No developer tools installed.
 | 
				
			||||||
      You should install the Command Line Tools.
 | 
					      You should install the Command Line Tools.
 | 
				
			||||||
    EOS
 | 
					 | 
				
			||||||
    if MacOS.version >= :mavericks
 | 
					 | 
				
			||||||
      message += <<-EOS.undent
 | 
					 | 
				
			||||||
        Run `xcode-select --install` to install them.
 | 
					 | 
				
			||||||
      EOS
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      message += <<-EOS.undent
 | 
					 | 
				
			||||||
      The standalone package can be obtained from
 | 
					      The standalone package can be obtained from
 | 
				
			||||||
        https://developer.apple.com/downloads/,
 | 
					        https://developer.apple.com/downloads
 | 
				
			||||||
      or it can be installed via Xcode's preferences.
 | 
					      or it can be installed via Xcode's preferences.
 | 
				
			||||||
      EOS
 | 
					      EOS
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    message
 | 
					  end
 | 
				
			||||||
  elsif MacOS::CLT.outdated?
 | 
					
 | 
				
			||||||
    message = <<-EOS.undent
 | 
					  def check_xcode_up_to_date
 | 
				
			||||||
      A newer Command Line Tools release is available
 | 
					    if MacOS::Xcode.installed? && MacOS::Xcode.outdated? then <<-EOS.undent
 | 
				
			||||||
 | 
					      Your Xcode (#{MacOS::Xcode.version}) is outdated
 | 
				
			||||||
 | 
					      Please update to Xcode #{MacOS::Xcode.latest_version}.
 | 
				
			||||||
 | 
					      Xcode can be updated from
 | 
				
			||||||
 | 
					        https://developer.apple.com/downloads
 | 
				
			||||||
      EOS
 | 
					      EOS
 | 
				
			||||||
    if MacOS.version >= :mavericks
 | 
					    end
 | 
				
			||||||
      message += <<-EOS.undent
 | 
					  end
 | 
				
			||||||
        Update them from Software Update in the App Store.
 | 
					
 | 
				
			||||||
      EOS
 | 
					  def check_clt_up_to_date
 | 
				
			||||||
    else
 | 
					    if MacOS::CLT.installed? && MacOS::CLT.outdated? then <<-EOS.undent
 | 
				
			||||||
      message += <<-EOS.undent
 | 
					      A newer Command Line Tools release is available.
 | 
				
			||||||
      The standalone package can be obtained from
 | 
					      The standalone package can be obtained from
 | 
				
			||||||
        https://developer.apple.com/downloads/,
 | 
					        https://developer.apple.com/downloads
 | 
				
			||||||
      or it can be installed via Xcode's preferences.
 | 
					      or it can be installed via Xcode's preferences.
 | 
				
			||||||
      EOS
 | 
					      EOS
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					  def check_for_installed_developer_tools
 | 
				
			||||||
 | 
					    unless MacOS::Xcode.installed? then <<-EOS.undent
 | 
				
			||||||
 | 
					      Xcode is not installed. Most formulae need Xcode to build.
 | 
				
			||||||
 | 
					      It can be installed from
 | 
				
			||||||
 | 
					        https://developer.apple.com/downloads
 | 
				
			||||||
 | 
					      EOS
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def check_xcode_up_to_date
 | 
				
			||||||
 | 
					    if MacOS::Xcode.installed? && MacOS::Xcode.outdated? then <<-EOS.undent
 | 
				
			||||||
 | 
					      Your Xcode (#{MacOS::Xcode.version}) is outdated
 | 
				
			||||||
 | 
					      Please update to Xcode #{MacOS::Xcode.latest_version}.
 | 
				
			||||||
 | 
					      Xcode can be updated from
 | 
				
			||||||
 | 
					        https://developer.apple.com/downloads
 | 
				
			||||||
 | 
					      EOS
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check_for_osx_gcc_installer
 | 
					def check_for_osx_gcc_installer
 | 
				
			||||||
@ -304,18 +312,6 @@ def check_for_stray_developer_directory
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check_standard_compilers
 | 
					 | 
				
			||||||
  return if check_xcode_clt # only check if Xcode is up to date
 | 
					 | 
				
			||||||
  compiler_status = MacOS.compilers_standard?
 | 
					 | 
				
			||||||
  if not compiler_status and not compiler_status.nil? then <<-EOS.undent
 | 
					 | 
				
			||||||
    Your compilers are different from the standard versions for your Xcode.
 | 
					 | 
				
			||||||
    If you have Xcode 4.3 or newer, you should install the Command Line Tools for
 | 
					 | 
				
			||||||
    Xcode from within Xcode's Download preferences.
 | 
					 | 
				
			||||||
    Otherwise, you should reinstall Xcode.
 | 
					 | 
				
			||||||
    EOS
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def __check_subdir_access base
 | 
					def __check_subdir_access base
 | 
				
			||||||
  target = HOMEBREW_PREFIX+base
 | 
					  target = HOMEBREW_PREFIX+base
 | 
				
			||||||
  return unless target.exist?
 | 
					  return unless target.exist?
 | 
				
			||||||
 | 
				
			|||||||
@ -64,9 +64,11 @@ module Homebrew extend self
 | 
				
			|||||||
  def check_xcode
 | 
					  def check_xcode
 | 
				
			||||||
    require 'cmd/doctor'
 | 
					    require 'cmd/doctor'
 | 
				
			||||||
    checks = Checks.new
 | 
					    checks = Checks.new
 | 
				
			||||||
    doctor_methods = ['check_xcode_clt', 'check_xcode_license_approved',
 | 
					    %w[
 | 
				
			||||||
                      'check_for_osx_gcc_installer']
 | 
					      check_for_installed_developer_tools
 | 
				
			||||||
    doctor_methods.each do |check|
 | 
					      check_xcode_license_approved
 | 
				
			||||||
 | 
					      check_for_osx_gcc_installer
 | 
				
			||||||
 | 
					    ].each do |check|
 | 
				
			||||||
      out = checks.send(check)
 | 
					      out = checks.send(check)
 | 
				
			||||||
      opoo out unless out.nil?
 | 
					      opoo out unless out.nil?
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user