diff options
| -rw-r--r-- | Library/Homebrew/brew.sh | 12 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/installer.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/system_command.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/diagnostic.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 8 |
5 files changed, 23 insertions, 14 deletions
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 60952c7fe..47064c61b 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -224,6 +224,15 @@ case "$HOMEBREW_COMMAND" in --config) HOMEBREW_COMMAND="config" ;; esac +if [[ "$HOMEBREW_COMMAND" = "cask" ]] +then + HOMEBREW_CASK_COMMAND="$1" + + case "$HOMEBREW_CASK_COMMAND" in + instal) HOMEBREW_CASK_COMMAND="install" ;; # gem does the same + esac +fi + # Set HOMEBREW_DEV_CMD_RUN for users who have run a development command. # This makes them behave like HOMEBREW_DEVELOPERs for brew update. if [[ -z "$HOMEBREW_DEVELOPER" ]] @@ -297,7 +306,8 @@ update-preinstall() { [[ -z "$HOMEBREW_AUTO_UPDATE_CHECKED" ]] || return [[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || return - if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "tap" ]] + if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "tap" || + "$HOMEBREW_CASK_COMMAND" = "install" || "$HOMEBREW_CASK_COMMAND" = "upgrade" ]] then if [[ -z "$HOMEBREW_VERBOSE" ]] then diff --git a/Library/Homebrew/cask/lib/hbc/artifact/installer.rb b/Library/Homebrew/cask/lib/hbc/artifact/installer.rb index 5cd388c7f..8fa54c01e 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/installer.rb @@ -23,7 +23,7 @@ module Hbc def install_phase(command: nil, **_) ohai "Running #{self.class.dsl_key} script '#{path.relative_path_from(cask.staged_path)}'" FileUtils.chmod "+x", path unless path.executable? - command.run(path, **args) + command.run(path, **args, path: PATH.new(HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"sbin", ENV["PATH"])) end end diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index a890c42e4..dfb301999 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -37,7 +37,7 @@ module Hbc result end - def initialize(executable, args: [], sudo: false, input: [], print_stdout: false, print_stderr: true, must_succeed: false, **options) + def initialize(executable, args: [], sudo: false, input: [], print_stdout: false, print_stderr: true, must_succeed: false, path: ENV["PATH"], **options) @executable = executable @args = args @sudo = sudo @@ -47,6 +47,7 @@ module Hbc @must_succeed = must_succeed options.extend(HashValidator).assert_valid_keys(:chdir) @options = options + @path = path end def command @@ -55,7 +56,7 @@ module Hbc private - attr_reader :executable, :args, :input, :options, :processed_output, :processed_status + attr_reader :executable, :args, :input, :options, :processed_output, :processed_status, :path attr_predicate :sudo?, :print_stdout?, :print_stderr?, :must_succeed? @@ -83,12 +84,8 @@ module Hbc def each_output_line(&b) executable, *args = expanded_command - unless File.exist?(executable) - executable = which(executable, PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin")) - end - raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = - Open3.popen3([executable, executable], *args, **options) + Open3.popen3({ "PATH" => path }, executable, *args, **options) write_input_to(raw_stdin) raw_stdin.close_write diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index d1de5ab00..8cbf124e6 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -822,7 +822,7 @@ module Homebrew return if linked.empty? inject_file_list linked.map(&:full_name), <<~EOS - Some keg-only formula are linked into the Cellar. + Some keg-only formulae are linked into the Cellar. Linking a keg-only formula, such as gettext, into the cellar with `brew link <formula>` will cause other formulae to detect them during the `./configure` step. This may cause problems when compiling those @@ -872,7 +872,7 @@ module Homebrew return if missing.empty? <<~EOS - Some installed formula are missing dependencies. + Some installed formulae are missing dependencies. You should `brew install` the missing dependencies: brew install #{missing.sort_by(&:full_name) * " "} diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index a89da9ae9..8d7f0aae1 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -566,7 +566,7 @@ class FormulaInstaller def caveats return if only_deps? - audit_installed if ARGV.homebrew_developer? && !formula.keg_only? + audit_installed if ARGV.homebrew_developer? caveats = Caveats.new(formula) @@ -882,8 +882,10 @@ class FormulaInstaller end def audit_installed - problem_if_output(check_env_path(formula.bin)) - problem_if_output(check_env_path(formula.sbin)) + unless formula.keg_only? + problem_if_output(check_env_path(formula.bin)) + problem_if_output(check_env_path(formula.sbin)) + end super end |
