From f7106dc2dbd44e71c2c348711b5973c678545c06 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 23 Jan 2025 13:58:14 +0000 Subject: [PATCH] formula_installer: improve quiet output. Quieten a few warnings, messages and caveats if we're passing `--quiet` to `brew install`. This also quiets an incorrect "Fetching" message that was being shown when installing from a local bottle. --- Library/Homebrew/formula_installer.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 8467b559f4517b..d9c8107ca5f477 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -440,7 +440,8 @@ def install # Warn if a more recent version of this formula is available in the tap. begin - if formula.pkg_version < (v = Formulary.factory(formula.full_name, force_bottle: force_bottle?).pkg_version) + if !quiet? && + formula.pkg_version < (v = Formulary.factory(formula.full_name, force_bottle: force_bottle?).pkg_version) opoo "#{formula.full_name} #{v} is available and more recent than version #{formula.pkg_version}." end rescue FormulaUnavailableError @@ -847,6 +848,7 @@ def caveats audit_installed if Homebrew::EnvConfig.developer? return if !installed_on_request? || installed_as_dependency? + return if quiet? caveats = Caveats.new(formula) @@ -873,6 +875,7 @@ def finish Homebrew::Install.global_post_install if build_bottle? || skip_post_install? + unless quiet? if build_bottle? ohai "Not running 'post_install' as we're building a bottle" elsif skip_post_install? @@ -880,6 +883,7 @@ def finish end puts "You can run it manually using:" puts " brew postinstall #{formula.full_name}" + end else formula.install_etc_var post_install if formula.post_install_defined? @@ -1321,6 +1325,7 @@ def fetch fetch_dependencies return if only_deps? + return if formula.local_bottle_path.present? oh1 "Fetching #{Formatter.identifier(formula.full_name)}".strip @@ -1347,8 +1352,7 @@ def fetch if check_attestation && Homebrew::Attestation.enabled? && formula.tap&.core_tap? && - formula.name != "gh" && - formula.local_bottle_path.blank? + formula.name != "gh" ohai "Verifying attestation for #{formula.name}" begin Homebrew::Attestation.check_core_attestation T.cast(downloadable_object, Bottle)