Tweaks for older Mac OS X versions.
- `brew update` should try to install `curl` before `git` on older versions of Mac OS X where it is needed for accessing modern SSL certificates. - We don't need an HTTP mirror for `git` because `curl` will already be installed before it is downloaded. - Don't recommend GCC on Mac OS X versions where it can't be built with the default system compiler. - Start using the Homebrew `curl` on Mac OS X versions where it is needed as soon as it is installed.
This commit is contained in:
		
							parent
							
								
									c0063bb827
								
							
						
					
					
						commit
						ffdda0eb9f
					
				@ -105,7 +105,14 @@ then
 | 
			
		||||
  HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X $HOMEBREW_MACOS_VERSION"
 | 
			
		||||
 | 
			
		||||
  printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
 | 
			
		||||
  if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" &&
 | 
			
		||||
  if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
 | 
			
		||||
  then
 | 
			
		||||
    HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  # The system Curl is too old for some modern HTTPS certificates on
 | 
			
		||||
  # older macOS versions.
 | 
			
		||||
  if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
 | 
			
		||||
        -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
 | 
			
		||||
  then
 | 
			
		||||
    HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl"
 | 
			
		||||
 | 
			
		||||
@ -385,6 +385,12 @@ EOS
 | 
			
		||||
 | 
			
		||||
  if ! git --version >/dev/null 2>&1
 | 
			
		||||
  then
 | 
			
		||||
    # we need a new enough curl to install git
 | 
			
		||||
    if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
 | 
			
		||||
        ! -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
 | 
			
		||||
    then
 | 
			
		||||
      brew install curl
 | 
			
		||||
    fi
 | 
			
		||||
    # we cannot install brewed git if homebrew/core is unavailable.
 | 
			
		||||
    [[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git
 | 
			
		||||
    unset GIT_EXECUTABLE
 | 
			
		||||
 | 
			
		||||
@ -574,7 +574,7 @@ class FormulaAuditor
 | 
			
		||||
 | 
			
		||||
    return unless @online
 | 
			
		||||
 | 
			
		||||
    return unless DevelopmentTools.curl_handles_most_https_homepages?
 | 
			
		||||
    return unless DevelopmentTools.curl_handles_most_https_certificates?
 | 
			
		||||
    if http_content_problem = FormulaAuditor.check_http_content(homepage,
 | 
			
		||||
                                               user_agents: [:browser, :default],
 | 
			
		||||
                                               check_content: true,
 | 
			
		||||
@ -1175,9 +1175,9 @@ class ResourceAuditor
 | 
			
		||||
    problem "Redundant :using value in URL"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.curl_git_openssl_and_deps
 | 
			
		||||
    @curl_git_openssl_and_deps ||= begin
 | 
			
		||||
      formulae_names = ["curl", "git", "openssl"]
 | 
			
		||||
  def self.curl_openssl_and_deps
 | 
			
		||||
    @curl_openssl_and_deps ||= begin
 | 
			
		||||
      formulae_names = ["curl", "openssl"]
 | 
			
		||||
      formulae_names += formulae_names.flat_map do |f|
 | 
			
		||||
        Formula[f].recursive_dependencies.map(&:name)
 | 
			
		||||
      end
 | 
			
		||||
@ -1190,11 +1190,14 @@ class ResourceAuditor
 | 
			
		||||
  def audit_urls
 | 
			
		||||
    urls = [url] + mirrors
 | 
			
		||||
 | 
			
		||||
    require_http = ResourceAuditor.curl_git_openssl_and_deps.include?(owner.name)
 | 
			
		||||
    curl_openssl_or_deps = ResourceAuditor.curl_openssl_and_deps.include?(owner.name)
 | 
			
		||||
 | 
			
		||||
    if spec_name == :stable && require_http &&
 | 
			
		||||
       !urls.find { |u| u.start_with?("http://") }
 | 
			
		||||
      problem "should always include at least one HTTP mirror"
 | 
			
		||||
    if spec_name == :stable && curl_openssl_or_deps
 | 
			
		||||
      problem "should not use xz tarballs" if url.end_with?(".xz")
 | 
			
		||||
 | 
			
		||||
      unless urls.find { |u| u.start_with?("http://") }
 | 
			
		||||
        problem "should always include at least one HTTP mirror"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    return unless @online
 | 
			
		||||
@ -1206,7 +1209,7 @@ class ResourceAuditor
 | 
			
		||||
        # A `brew mirror`'ed URL is usually not yet reachable at the time of
 | 
			
		||||
        # pull request.
 | 
			
		||||
        next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/}
 | 
			
		||||
        if http_content_problem = FormulaAuditor.check_http_content(url, require_http: require_http)
 | 
			
		||||
        if http_content_problem = FormulaAuditor.check_http_content(url, require_http: curl_openssl_or_deps)
 | 
			
		||||
          problem http_content_problem
 | 
			
		||||
        end
 | 
			
		||||
      elsif strategy <= GitDownloadStrategy
 | 
			
		||||
 | 
			
		||||
@ -114,7 +114,7 @@ class DevelopmentTools
 | 
			
		||||
      @non_apple_gcc_version = {}
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def curl_handles_most_https_homepages?
 | 
			
		||||
    def curl_handles_most_https_certificates?
 | 
			
		||||
      true
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -43,11 +43,16 @@ class DevelopmentTools
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def custom_installation_instructions
 | 
			
		||||
      if MacOS.version > :tiger
 | 
			
		||||
      if MacOS.version > :leopard
 | 
			
		||||
        <<-EOS.undent
 | 
			
		||||
          Install GNU's GCC
 | 
			
		||||
            brew install gcc
 | 
			
		||||
        EOS
 | 
			
		||||
      elsif MacOS.version > :tiger
 | 
			
		||||
        <<-EOS.undent
 | 
			
		||||
          Install GNU's GCC
 | 
			
		||||
            brew install gcc@4.6
 | 
			
		||||
        EOS
 | 
			
		||||
      else
 | 
			
		||||
        # Tiger doesn't ship with apple-gcc42, and this is required to build
 | 
			
		||||
        # some software that doesn't build properly with FSF GCC.
 | 
			
		||||
@ -55,7 +60,7 @@ class DevelopmentTools
 | 
			
		||||
          Install Apple's GCC
 | 
			
		||||
            brew install apple-gcc42
 | 
			
		||||
          or GNU's GCC
 | 
			
		||||
            brew install gcc
 | 
			
		||||
            brew install gcc@4.6
 | 
			
		||||
        EOS
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
@ -77,10 +82,10 @@ class DevelopmentTools
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def curl_handles_most_https_homepages?
 | 
			
		||||
      # The system Curl is too old for some modern HTTPS homepages on
 | 
			
		||||
    def curl_handles_most_https_certificates?
 | 
			
		||||
      # The system Curl is too old for some modern HTTPS certificates on
 | 
			
		||||
      # older macOS versions.
 | 
			
		||||
      MacOS.version >= :el_capitan
 | 
			
		||||
      !ENV["HOMEBREW_SYSTEM_CURL_TOO_OLD"].nil?
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def subversion_handles_most_https_certificates?
 | 
			
		||||
 | 
			
		||||
@ -603,6 +603,12 @@ class FormulaInstaller
 | 
			
		||||
 | 
			
		||||
    # let's reset Utils.git_available? if we just installed git
 | 
			
		||||
    Utils.clear_git_available_cache if formula.name == "git"
 | 
			
		||||
 | 
			
		||||
    # use installed curl when it's needed and available
 | 
			
		||||
    if formula.name == "curl" &&
 | 
			
		||||
       !DevelopmentTools.curl_handles_most_https_certificates?
 | 
			
		||||
      ENV["HOMEBREW_CURL"] = formula.opt_bin/"curl"
 | 
			
		||||
    end
 | 
			
		||||
  ensure
 | 
			
		||||
    unlock
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user