Skip to content

Commit

Permalink
Also set --overwrite for pre-install checks
Browse files Browse the repository at this point in the history
And skip displaying the message if `--overwrite` was already requested.
  • Loading branch information
carlocab committed Oct 23, 2024
1 parent 79959ca commit 04d7c40
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions Library/Homebrew/cmd/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,8 @@ def run
puts "You're on your own. Failures are expected so don't create any issues, please!"
end

installed_formulae = formulae.select do |f|
Install.install_formula?(
f,
head: args.HEAD?,
fetch_head: args.fetch_HEAD?,
only_dependencies: args.only_dependencies?,
force: args.force?,
quiet: args.quiet?,
overwrite: args.overwrite?,
)
end

return if formulae.any? && installed_formulae.empty?

Install.perform_preinstall_checks_once
Install.check_cc_argv(args.cc)

overwrite = if GitHub::Actions.env_set? &&
overwrite = if !args.overwrite? &&
GitHub::Actions.env_set? &&
ENV["HOMEBREW_GITHUB_ACTIONS_NO_INSTALL_OVERWRITE"].blank? &&
ENV["HOMEBREW_GITHUB_ACTIONS"].blank?
if ENV["HOMEBREW_GITHUB_ACTIONS_NO_INSTALL_OVERWRITE_WARNING"].blank?
Expand All @@ -307,7 +291,7 @@ def run
To disable this behaviour, set `HOMEBREW_GITHUB_ACTIONS_NO_INSTALL_OVERWRITE`.
To silence this warning, set `HOMEBREW_GITHUB_ACTIONS_NO_INSTALL_OVERWRITE_WARNING`.
To silence this warning, set `HOMEBREW_GITHUB_ACTIONS_NO_INSTALL_OVERWRITE_WARNING` or pass `--overwrite` to `brew install`.
WARNING

puts GitHub::Actions::Annotation.new(:warning, message)
Expand All @@ -324,6 +308,23 @@ def run
args.overwrite?
end

installed_formulae = formulae.select do |f|
Install.install_formula?(
f,
head: args.HEAD?,
fetch_head: args.fetch_HEAD?,
only_dependencies: args.only_dependencies?,
force: args.force?,
quiet: args.quiet?,
overwrite:,
)
end

return if formulae.any? && installed_formulae.empty?

Install.perform_preinstall_checks_once
Install.check_cc_argv(args.cc)

Install.install_formulae(
installed_formulae,
build_bottle: args.build_bottle?,
Expand Down

0 comments on commit 04d7c40

Please sign in to comment.