Merge pull request #12100 from Bo98/fi-fix-no-bottle

formula_installer: fix error if a compatible bottle was not found
This commit is contained in:
Bo Anderson 2021-09-20 22:55:08 +01:00 committed by GitHub
commit 91acec50f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -63,7 +63,7 @@ module Homebrew
sig { params(formula: Formula, args: CLI::Args).void }
def print_formula_cache(formula, args:)
if fetch_bottle?(formula, args: args)
puts formula.bottle_for_tag(args.bottle_tag).cached_download
puts formula.bottle_for_tag(args.bottle_tag&.to_sym).cached_download
elsif args.HEAD?
puts formula.head.cached_download
else

View File

@ -93,7 +93,7 @@ module Homebrew
begin
f.clear_cache if args.force?
f.fetch_bottle_tab
fetch_formula(f.bottle_for_tag(args.bottle_tag), args: args)
fetch_formula(f.bottle_for_tag(args.bottle_tag&.to_sym), args: args)
rescue Interrupt
raise
rescue => e

View File

@ -371,7 +371,7 @@ class Formula
# The Bottle object for given tag.
# @private
sig { params(tag: T.nilable(String)).returns(T.nilable(Bottle)) }
sig { params(tag: T.nilable(Symbol)).returns(T.nilable(Bottle)) }
def bottle_for_tag(tag = nil)
Bottle.new(self, bottle_specification, tag) if bottled?(tag)
end

View File

@ -150,8 +150,10 @@ class FormulaInstaller
return false
end
bottle = formula.bottle
if bottle && !bottle.compatible_locations?
bottle = formula.bottle_for_tag(Utils::Bottles.tag.to_sym)
return false if bottle.nil?
unless bottle.compatible_locations?
if output_warning
prefix = Pathname(bottle.cellar).parent
opoo <<~EOS