Skip to content

Commit

Permalink
Merge pull request #15944 from MikeMcQuaid/more_liberal_formula_upgrade
Browse files Browse the repository at this point in the history
upgrade: more liberal formula upgrade changes.
  • Loading branch information
MikeMcQuaid committed Sep 5, 2023
2 parents 51889e7 + 72ded32 commit fbc1e84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class FormulaInstaller
extend Predicable

attr_reader :formula
attr_reader :bottle_tab_runtime_dependencies

attr_accessor :options, :link_keg

Expand Down Expand Up @@ -96,7 +97,7 @@ def initialize(
@requirement_messages = []
@poured_bottle = false
@start_time = nil
@bottle_tab_runtime_dependencies = {}
@bottle_tab_runtime_dependencies = {}.freeze

# Take the original formula instance, which might have been swapped from an API instance to a source instance
@formula = previously_fetched_formula if previously_fetched_formula
Expand Down
16 changes: 16 additions & 0 deletions Library/Homebrew/upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def upgrade_formulae(
installed_on_request: false,
force_bottle: false,
build_from_source_formulae: [],
dependents: false,
interactive: false,
keep_tmp: false,
debug_symbols: false,
Expand Down Expand Up @@ -70,6 +71,20 @@ def upgrade_formulae(
)
unless dry_run
fi.prelude

# Don't need to install this bottle if all the runtime dependencies
# are already satisfied.
next if dependents && fi.bottle_tab_runtime_dependencies.presence&.none? do |dependency, hash|
installed_version = begin
Formula[dependency].any_installed_version
rescue FormulaUnavailableError
nil
end
next true unless installed_version

Version.new(hash["version"]) > installed_version.version
end

fi.fetch
end
fi
Expand Down Expand Up @@ -336,6 +351,7 @@ def check_installed_dependents(
installed_on_request: installed_on_request,
force_bottle: force_bottle,
build_from_source_formulae: build_from_source_formulae,
dependents: true,
interactive: interactive,
keep_tmp: keep_tmp,
debug_symbols: debug_symbols,
Expand Down

0 comments on commit fbc1e84

Please sign in to comment.