2021-09-11 01:00:23 +01:00
|
|
|
# typed: strict
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-06-05 23:19:18 -04:00
|
|
|
module Homebrew
|
2020-08-17 04:53:36 +02:00
|
|
|
# @api private
|
2018-06-05 23:19:18 -04:00
|
|
|
module Fetch
|
2023-05-09 18:07:32 +08:00
|
|
|
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:)
|
2023-03-10 23:46:07 +00:00
|
|
|
bottle = formula.bottle
|
2020-11-29 22:36:54 +01:00
|
|
|
|
2023-05-09 18:07:32 +08:00
|
|
|
return true if force_bottle && bottle.present?
|
|
|
|
return true if bottle_tag.present? && formula.bottled?(bottle_tag)
|
2018-09-17 02:45:00 +02:00
|
|
|
|
2021-01-07 13:49:05 -08:00
|
|
|
bottle.present? &&
|
2023-03-10 23:46:07 +00:00
|
|
|
formula.pour_bottle? &&
|
2023-05-09 18:07:32 +08:00
|
|
|
build_from_source_formulae.exclude?(formula.full_name) &&
|
2021-01-07 13:49:05 -08:00
|
|
|
bottle.compatible_locations?
|
2018-06-05 23:19:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|