brew/Library/Homebrew/fetch.rb

36 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2021-09-11 01:00:23 +01:00
# typed: strict
# frozen_string_literal: true
module Homebrew
module Fetch
sig {
params(
formula: Formula,
force_bottle: T::Boolean,
bottle_tag: T.nilable(Symbol),
build_from_source_formulae: T::Array[String],
os: T.nilable(Symbol),
arch: T.nilable(Symbol),
).returns(T::Boolean)
}
def fetch_bottle?(formula, force_bottle:, bottle_tag:, build_from_source_formulae:, os:, arch:)
bottle = formula.bottle
2020-11-29 22:36:54 +01:00
return true if force_bottle && bottle.present?
2023-05-05 07:34:19 +02:00
if os.present?
return true
elsif ENV["HOMEBREW_TEST_GENERIC_OS"].present?
2024-04-30 11:10:23 +02:00
# `:generic` bottles don't exist and `--os` flag is not specified.
2023-05-05 07:34:19 +02:00
return false
end
return true if arch.present?
return true if bottle_tag.present? && formula.bottled?(bottle_tag)
2018-09-17 02:45:00 +02:00
bottle.present? &&
formula.pour_bottle? &&
build_from_source_formulae.exclude?(formula.full_name) &&
bottle.compatible_locations?
end
end
end