diff options
26 files changed, 95 insertions, 51 deletions
| diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index bb663537d..f31224ab2 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -69,6 +69,14 @@ begin      end    end +  unless internal_cmd +    # Add contributed commands to PATH before checking. +    homebrew_path.append(Tap.cmd_directories) + +    # External commands expect a normal PATH +    ENV["PATH"] = homebrew_path +  end +    # Usage instructions should be displayed if and only if one of:    # - a help flag is passed AND a command is matched    # - a help flag is passed AND there is no command specified @@ -88,14 +96,6 @@ begin      system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")    end -  unless internal_cmd -    # Add contributed commands to PATH before checking. -    homebrew_path.append(Tap.cmd_directories) - -    # External commands expect a normal PATH -    ENV["PATH"] = homebrew_path -  end -    if internal_cmd      Homebrew.send cmd.to_s.tr("-", "_").downcase    elsif which "brew-#{cmd}" diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 15caca8ef..fa9cb20d3 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -25,6 +25,15 @@ then    ruby_SHA="33643b1ca6f860d6df01686636326785763e5e81cf0cef37d8a7ab96a6ca1fa1"  fi +# Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set. +quiet_stderr() { +  if [[ -z "$HOMEBREW_STDERR" ]]; then +    command "$@" 2>/dev/null +  else +    command "$@" +  fi +} +  fetch() {    local -a curl_args    local sha @@ -144,7 +153,7 @@ install() {    tar "$tar_args" "$CACHED_LOCATION"    safe_cd "$VENDOR_DIR/portable-$VENDOR_NAME" -  if "./$VENDOR_VERSION/bin/$VENDOR_NAME" --version >/dev/null 2>&1 +  if quiet_stderr "./$VENDOR_VERSION/bin/$VENDOR_NAME" --version >/dev/null    then      ln -sfn "$VENDOR_VERSION" current      # remove old vendor installations by sorting files with modified time. diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index a54211f5c..204e7cef9 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -469,6 +469,17 @@ module Homebrew          end          unless ARGV.include? "--no-commit" +          if ENV["HOMEBREW_GIT_NAME"] +            ENV["GIT_AUTHOR_NAME"] = +              ENV["GIT_COMMITTER_NAME"] = +                ENV["HOMEBREW_GIT_NAME"] +          end +          if ENV["HOMEBREW_GIT_EMAIL"] +            ENV["GIT_AUTHOR_EMAIL"] = +              ENV["GIT_COMMITTER_EMAIL"] = +                ENV["HOMEBREW_GIT_EMAIL"] +          end +            short_name = formula_name.split("/", -1).last            pkg_version = bottle_hash["formula"]["pkg_version"] diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 51a892e28..e1b1bb8ee 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -434,7 +434,7 @@ module Homebrew          message = "" -        paths(ENV["HOMEBREW_PATH"]).each do |p| +        paths.each do |p|            case p            when "/usr/bin"              unless @seen_prefix_bin @@ -577,7 +577,7 @@ module Homebrew            /Applications/Server.app/Contents/ServerRoot/usr/sbin          ].map(&:downcase) -        paths(ENV["HOMEBREW_PATH"]).each do |p| +        paths.each do |p|            next if whitelist.include?(p.downcase) || !File.directory?(p)            realpath = Pathname.new(p).realpath.to_s @@ -1045,7 +1045,7 @@ module Homebrew        end        def check_for_external_cmd_name_conflict -        cmds = paths.flat_map { |p| Dir["#{p}/brew-*"] }.uniq +        cmds = Tap.cmd_directories.flat_map { |p| Dir["#{p}/brew-*"] }.uniq          cmds = cmds.select { |cmd| File.file?(cmd) && File.executable?(cmd) }          cmd_map = {}          cmds.each do |cmd| diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 65b8d7cde..f0b923f21 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -19,6 +19,7 @@ module Homebrew          %w[            check_xcode_minimum_version            check_clt_minimum_version +          check_if_xcode_needs_clt_installed          ].freeze        end @@ -56,7 +57,7 @@ module Homebrew          # `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew          # repository. This only needs to support whatever CI provider          # Homebrew/brew is currently using. -        return if ENV["TRAVIS"] +        return if ENV["HOMEBREW_TRAVIS"]          message = <<~EOS            Your Xcode (#{MacOS::Xcode.version}) is outdated. @@ -83,7 +84,7 @@ module Homebrew          # `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew          # repository. This only needs to support whatever CI provider          # Homebrew/brew is currently using. -        return if ENV["TRAVIS"] +        return if ENV["HOMEBREW_TRAVIS"]          <<~EOS            A newer Command Line Tools release is available. @@ -124,6 +125,15 @@ module Homebrew          EOS        end +      def check_if_xcode_needs_clt_installed +        return unless MacOS::Xcode.needs_clt_installed? + +        <<~EOS +          Xcode alone is not sufficient on #{MacOS.version.pretty_name}. +          #{DevelopmentTools.installation_instructions} +        EOS +      end +        def check_for_osx_gcc_installer          return unless MacOS.version < "10.7" || ((MacOS::Xcode.version || "0") > "4.1")          return unless DevelopmentTools.clang_version == "2.1" diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index dd273cfbc..1a6d10f3b 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -60,7 +60,6 @@ module Stdenv      # previously added by macosxsdk      version = version.to_s      remove_from_cflags(/ ?-mmacosx-version-min=10\.\d+/) -    delete("MACOSX_DEPLOYMENT_TARGET")      delete("CPATH")      remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" @@ -83,7 +82,6 @@ module Stdenv      remove_macosxsdk      version = version.to_s      append_to_cflags("-mmacosx-version-min=#{version}") -    self["MACOSX_DEPLOYMENT_TARGET"] = version      self["CPATH"] = "#{HOMEBREW_PREFIX}/include"      prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index ee0d2343c..f233002ea 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -9,7 +9,7 @@ module Superenv    end    def effective_sysroot -    MacOS::Xcode.without_clt? ? MacOS.sdk_path.to_s : nil +    MacOS.sdk_path.to_s if MacOS::Xcode.without_clt?    end    def homebrew_extra_paths @@ -90,11 +90,7 @@ module Superenv    def setup_build_environment(formula = nil)      generic_setup_build_environment(formula)      self["HOMEBREW_SDKROOT"] = effective_sysroot - -    if MacOS::Xcode.without_clt? || MacOS::Xcode.version.to_i >= 7 -      self["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version.to_s -      self["SDKROOT"] = MacOS.sdk_path -    end +    self["SDKROOT"] = MacOS.sdk_path if MacOS::Xcode.without_clt?      # Filter out symbols known not to be defined since GNU Autotools can't      # reliably figure this out with Xcode 8 and above. diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 82cf10be0..07919f8a0 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -495,7 +495,7 @@ module ObserverPathnameExtension      MAXIMUM_VERBOSE_OUTPUT = 100      def verbose? -      return ARGV.verbose? unless ENV["TRAVIS"] +      return ARGV.verbose? unless ENV["HOMEBREW_TRAVIS"]        return false unless ARGV.verbose?        if total < MAXIMUM_VERBOSE_OUTPUT diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 42abe5171..2285fee91 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -702,7 +702,7 @@ class FormulaInstaller      Utils.safe_fork do        # Invalidate the current sudo timestamp in case a build script calls sudo.        # Travis CI's Linux sudoless workers have a weird sudo that fails here. -      system "/usr/bin/sudo", "-k" unless ENV["TRAVIS_SUDO"] == "false" +      system "/usr/bin/sudo", "-k" unless ENV["HOMEBREW_TRAVIS_SUDO"] == "false"        if Sandbox.formula?(formula)          sandbox = Sandbox.new diff --git a/Library/Homebrew/official_taps.rb b/Library/Homebrew/official_taps.rb index ed966c804..d2e4753d9 100644 --- a/Library/Homebrew/official_taps.rb +++ b/Library/Homebrew/official_taps.rb @@ -1,5 +1,4 @@  OFFICIAL_TAPS = %w[ -  nginx    php    science  ].freeze @@ -26,6 +25,7 @@ DEPRECATED_OFFICIAL_TAPS = %w[    games    gui    head-only +  nginx    python    tex    versions diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 9215e3c96..ade801c42 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -31,16 +31,25 @@ module OS        @version = nil      end -    def prerelease? -      # TODO: bump version when new OS is released -      version >= "10.14" +    def latest_sdk_version +      # TODO: bump version when new Xcode macOS SDK is released +      Version.new "10.13" +    end + +    def latest_stable_version +      # TODO: bump version when new macOS is released +      Version.new "10.13"      end      def outdated_release? -      # TODO: bump version when new OS is released +      # TODO: bump version when new macOS is released        version < "10.11"      end +    def prerelease? +      version > latest_stable_version +    end +      def cat        version.to_sym      end diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 96be56e3b..ae725d948 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -40,6 +40,15 @@ module OS          version < minimum_version        end +      def latest_sdk_version? +        OS::Mac.version == OS::Mac.latest_sdk_version +      end + +      def needs_clt_installed? +        return false if latest_sdk_version? +        without_clt? +      end +        def outdated?          return false unless installed?          version < latest_version diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb index a44add10e..1b379ba0f 100644 --- a/Library/Homebrew/patch.rb +++ b/Library/Homebrew/patch.rb @@ -64,10 +64,9 @@ class EmbeddedPatch    def apply      data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX) -    cmd = "/usr/bin/patch"      args = %W[-g 0 -f -#{strip}] -    IO.popen("#{cmd} #{args.join(" ")}", "w") { |p| p.write(data) } -    raise ErrorDuringExecution.new(cmd, args) unless $CHILD_STATUS.success? +    Utils.popen_write("patch", *args) { |p| p.write(data) } +    raise ErrorDuringExecution.new("patch", args) unless $CHILD_STATUS.success?    end    def inspect @@ -150,7 +149,7 @@ class ExternalPatch          patch_files.each do |patch_file|            ohai "Applying #{patch_file}"            patch_file = patch_dir/patch_file -          safe_system "/usr/bin/patch", "-g", "0", "-f", "-#{strip}", "-i", patch_file +          safe_system "patch", "-g", "0", "-f", "-#{strip}", "-i", patch_file          end        end      end diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb index 69fbeb56e..8a35e7d24 100644 --- a/Library/Homebrew/rubocops/formula_desc_cop.rb +++ b/Library/Homebrew/rubocops/formula_desc_cop.rb @@ -40,7 +40,7 @@ module RuboCop        # - Checks for correct usage of `command-line` in `desc`        # - Checks description starts with a capital letter        # - Checks if `desc` contains the formula name -      # - Checks if `desc` ends with a full stop +      # - Checks if `desc` ends with a full stop (apart from in the case of "etc.")        class Desc < FormulaCop          VALID_LOWERCASE_WORDS = %w[            ex @@ -83,8 +83,8 @@ module RuboCop              problem "Description shouldn't start with the formula name"            end -          # Check if a full stop is used at the end of a formula's desc -          return unless regex_match_group(desc, /\.$/) +          # Check if a full stop is used at the end of a formula's desc (apart from in the case of "etc.") +          return unless regex_match_group(desc, /\.$/) && !string_content(desc).end_with?("etc.")            problem "Description shouldn't end with a full stop"          end @@ -103,7 +103,7 @@ module RuboCop              correction.gsub!(/(^|[^a-z])#{@formula_name}([^a-z]|$)/i, "\\1\\2")              correction.gsub!(/^(['"]?)\s+/, "\\1")              correction.gsub!(/\s+(['"]?)$/, "\\1") -            correction.gsub!(/\.$/, "") +            correction.gsub!(/\.(['"]?)$/, "\\1")              corrector.insert_before(node.source_range, correction)              corrector.remove(node.source_range)            end diff --git a/Library/Homebrew/test/diagnostic_spec.rb b/Library/Homebrew/test/diagnostic_spec.rb index 8a25413ed..f347010a9 100644 --- a/Library/Homebrew/test/diagnostic_spec.rb +++ b/Library/Homebrew/test/diagnostic_spec.rb @@ -194,7 +194,7 @@ describe Homebrew::Diagnostic::Checks do            FileUtils.chmod 0755, cmd          end -        ENV["PATH"] = [path1, path2, ENV["PATH"]].join File::PATH_SEPARATOR +        allow(Tap).to receive(:cmd_directories).and_return([path1, path2])          expect(subject.check_for_external_cmd_name_conflict)            .to match("brew-foo") diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 08766ea37..c3652fc42 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -9,7 +9,7 @@ require "set"  if ENV["HOMEBREW_TESTS_COVERAGE"]    require "simplecov" -  if ENV["CODECOV_TOKEN"] || ENV["TRAVIS"] +  if ENV["CODECOV_TOKEN"] || ENV["HOMEBREW_TRAVIS"]      require "codecov"      SimpleCov.formatter = SimpleCov::Formatter::Codecov    end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 1d16044da..48ab94c4f 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -420,8 +420,8 @@ def nostdout    end  end -def paths(env_path = ENV["PATH"]) -  @paths ||= PATH.new(env_path).collect do |p| +def paths +  @paths ||= PATH.new(ENV["HOMEBREW_PATH"]).collect do |p|      begin        File.expand_path(p).chomp("/")      rescue ArgumentError diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index eaa81352c..5becf8203 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -27,7 +27,7 @@ def curl_args(*extra_args, show_output: false, user_agent: :default)      args << "--fail"      args << "--progress-bar" unless ARGV.verbose?      args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"] -    args << "--silent" if !$stdout.tty? || ENV["TRAVIS"] +    args << "--silent" if !$stdout.tty? || ENV["HOMEBREW_TRAVIS"]    end    args + extra_args @@ -47,7 +47,7 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"  # Whitelist and copy to HOMEBREW_* all variables previously mentioned in  # manpage or used elsewhere by Homebrew.  for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \ -           BROWSER EDITOR GIT PATH VISUAL \ +           BROWSER EDITOR GIT PATH VISUAL TRAVIS TRAVIS_SUDO \             GITHUB_USER GITHUB_PASSWORD GITHUB_TOKEN  do    # Skip if variable value is empty. @@ -59,12 +59,13 @@ do    export "$VAR_NEW"="${!VAR}"  done -if [[ -n "$HOMEBREW_ENV_FILTERING" ]] +# test-bot sets environment filtering itself +if [[ -n "$HOMEBREW_ENV_FILTERING" && "$1" != "test-bot" ]]  then    PATH="/usr/bin:/bin:/usr/sbin:/sbin"    FILTERED_ENV=() -  for VAR in HOME SHELL PATH TERM LOGNAME USER "${!HOMEBREW_@}" +  for VAR in HOME SHELL PATH TERM LOGNAME USER CI "${!HOMEBREW_@}"    do      FILTERED_ENV+=( "${VAR}=${!VAR}" )    done diff --git a/completions/zsh/_brew_cask b/completions/zsh/_brew_cask index 1e493fc2a..ff277ea60 100644 --- a/completions/zsh/_brew_cask +++ b/completions/zsh/_brew_cask @@ -40,6 +40,8 @@ __brew_cask_commands() {      'info:displays information about the given Cask'      'install:installs the given Cask'      'list:with no args, lists installed Casks; given installed Casks, lists staged files' +    'outdated:list the outdated installed Casks' +    'reinstall:reinstalls the given Cask'      'search:searches all known Casks'      'style:checks Cask style using RuboCop'      'uninstall:uninstalls the given Cask' diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index 8b263cb38..740e973d2 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -24,7 +24,7 @@ The Python formulae install [pip](http://www.pip-installer.org) (as `pip2` or `p  Setuptools can be updated via pip, without having to re-brew Python:  ```sh -python2 -m pip --upgrade setuptools +python2 -m pip install --upgrade setuptools  ```  Similarly, pip can be used to upgrade itself via: diff --git a/docs/How-To-Open-a-Homebrew-Pull-Request.md b/docs/How-To-Open-a-Homebrew-Pull-Request.md index 7d6af1698..173ea4e1d 100644 --- a/docs/How-To-Open-a-Homebrew-Pull-Request.md +++ b/docs/How-To-Open-a-Homebrew-Pull-Request.md @@ -25,7 +25,7 @@ Depending on the change you want to make, you need to send the pull request to t  3. Add your pushable forked repository with `git remote add <YOUR_USERNAME> https://github.com/<YOUR_USERNAME>/homebrew-core.git`    * `<YOUR_USERNAME>` is your GitHub username, not your local machine username. -For formulae in central taps other than `homebrew/core`, such as `homebrew/science` or `homebrew/nginx`, substitute that tap's name for `homebrew/core` in each step, and alter the GitHub repository URLs as necessary. +For formulae in central taps other than `homebrew/core`, such as `homebrew/science` or `homebrew/php`, substitute that tap's name for `homebrew/core` in each step, and alter the GitHub repository URLs as necessary.  ## Create your pull request from a new branch diff --git a/docs/How-to-Create-and-Maintain-a-Tap.md b/docs/How-to-Create-and-Maintain-a-Tap.md index c9a8da642..610380aa6 100644 --- a/docs/How-to-Create-and-Maintain-a-Tap.md +++ b/docs/How-to-Create-and-Maintain-a-Tap.md @@ -27,7 +27,7 @@ If it’s on GitHub, users can install any of your formulae with  file here.  If they want to get your tap without installing any formula at the same time, -users can add it with the [`brew tap` command](brew-tap.md). +users can add it with the [`brew tap` command](Taps.md).  If it’s on GitHub, they can use `brew tap user/repo`, where `user` is your  GitHub username and `homebrew-repo` your repository. diff --git a/docs/Interesting-Taps-and-Forks.md b/docs/Interesting-Taps-and-Forks.md index 5e3fc19d2..b49238674 100644 --- a/docs/Interesting-Taps-and-Forks.md +++ b/docs/Interesting-Taps-and-Forks.md @@ -5,8 +5,6 @@ Homebrew has the capability to add (and remove) multiple taps to your local inst  ## Main taps -*   [homebrew/nginx](https://github.com/Homebrew/homebrew-nginx): A tap for NGINX modules, intended for its `nginx-full` formula which includes more module options. -  *   [homebrew/php](https://github.com/Homebrew/homebrew-php): Repository for PHP-related formulae.  *   [homebrew/science](https://github.com/Homebrew/homebrew-science): A collection of scientific libraries and tools. @@ -17,6 +15,8 @@ You can be added as a maintainer for one of the Homebrew organization taps and a  ## Other interesting taps +*   [denji/nginx](https://github.com/denji/homebrew-nginx): A tap for NGINX modules, intended for its `nginx-full` formula which includes more module options. +  *   [InstantClientTap/instantclient](https://github.com/InstantClientTap/homebrew-instantclient): A tap for Oracle Instant Client. The packages need to be downloaded manually.  *   [osx-cross/avr](https://github.com/osx-cross/homebrew-avr): GNU AVR toolchain (Libc, compilers and other tools for Atmel MCUs, useful for Arduino hackers and AVR programmers). diff --git a/docs/README.md b/docs/README.md index 07ff9074c..f069ae562 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,7 +9,7 @@  - [Tips and Tricks](Tips-N'-Tricks.md)  - [Bottles (binary packages)](Bottles.md) -- [Taps (third-party repositories)](brew-tap.md) +- [Taps (third-party repositories)](Taps.md)  - [Interesting Taps and Forks](Interesting-Taps-and-Forks.md)  - [Anonymous Aggregate User Behaviour Analytics](Analytics.md) diff --git a/docs/brew-tap.md b/docs/Taps.md index 59825a0c9..59825a0c9 100644 --- a/docs/brew-tap.md +++ b/docs/Taps.md | 
