parent
b3f7c6f7a5
commit
69c16739d2
@ -58,7 +58,8 @@ module Homebrew
|
||||
|
||||
sig { params(formula: Formula, args: CLI::Args).void }
|
||||
def self.print_formula_cache(formula, args:)
|
||||
if fetch_bottle?(formula, args: args)
|
||||
if fetch_bottle?(formula, force_bottle: args.force_bottle?, bottle_tag: args.bottle_tag&.to_sym,
|
||||
build_from_source_formulae: args.build_from_source_formulae)
|
||||
puts formula.bottle_for_tag(args.bottle_tag&.to_sym)&.cached_download
|
||||
elsif args.HEAD?
|
||||
puts formula.head.cached_download
|
||||
|
||||
@ -96,7 +96,8 @@ module Homebrew
|
||||
f.print_tap_action verb: "Fetching"
|
||||
|
||||
fetched_bottle = false
|
||||
if fetch_bottle?(f, args: args)
|
||||
if fetch_bottle?(f, force_bottle: args.force_bottle?, bottle_tag: args.bottle_tag&.to_sym,
|
||||
build_from_source_formulae: args.build_from_source_formulae)
|
||||
begin
|
||||
f.clear_cache if args.force?
|
||||
f.fetch_bottle_tab
|
||||
|
||||
@ -4,16 +4,23 @@
|
||||
module Homebrew
|
||||
# @api private
|
||||
module Fetch
|
||||
sig { params(formula: Formula, args: CLI::Args).returns(T::Boolean) }
|
||||
def fetch_bottle?(formula, args:)
|
||||
sig {
|
||||
params(
|
||||
formula: Formula,
|
||||
force_bottle: T::Boolean,
|
||||
bottle_tag: T.nilable(Symbol),
|
||||
build_from_source_formulae: T::Array[String],
|
||||
).returns(T::Boolean)
|
||||
}
|
||||
def fetch_bottle?(formula, force_bottle:, bottle_tag:, build_from_source_formulae:)
|
||||
bottle = formula.bottle
|
||||
|
||||
return true if args.force_bottle? && bottle.present?
|
||||
return true if args.bottle_tag.present? && formula.bottled?(args.bottle_tag&.to_sym)
|
||||
return true if force_bottle && bottle.present?
|
||||
return true if bottle_tag.present? && formula.bottled?(bottle_tag)
|
||||
|
||||
bottle.present? &&
|
||||
formula.pour_bottle? &&
|
||||
args.build_from_source_formulae.exclude?(formula.full_name) &&
|
||||
build_from_source_formulae.exclude?(formula.full_name) &&
|
||||
bottle.compatible_locations?
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user