diff options
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/brew.sh | 9 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/update.sh | 6 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 21 | ||||
| -rw-r--r-- | Library/Homebrew/development_tools.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/extend/os/mac/development_tools.rb | 15 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 6 | 
6 files changed, 43 insertions, 16 deletions
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index c40ce8bf7..66908925c 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -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" diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index fb6a3459c..e8211e4dd 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -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 diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 4220fce47..e2a288fdb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -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 diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb index 996dea87c..b7787d849 100644 --- a/Library/Homebrew/development_tools.rb +++ b/Library/Homebrew/development_tools.rb @@ -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 diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb index caa85ffca..66b3bf9d2 100644 --- a/Library/Homebrew/extend/os/mac/development_tools.rb +++ b/Library/Homebrew/extend/os/mac/development_tools.rb @@ -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? diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 216a375ce..e955dcf07 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -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  | 
