Module: Homebrew::Fetch Private

Included in:
Cmd::Cache, Cmd::FetchCmd
Defined in:
fetch.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Instance Method Summary collapse

Instance Method Details

#fetch_bottle?(formula, force_bottle:, bottle_tag:, build_from_source_formulae:, os:, arch:) ⇒ Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'fetch.rb', line 16

def fetch_bottle?(formula, force_bottle:, bottle_tag:, build_from_source_formulae:, os:, arch:)
  bottle = formula.bottle

  return true if force_bottle && bottle.present?
  if os.present?
    return true
  elsif ENV["HOMEBREW_TEST_GENERIC_OS"].present?
    # `:generic` bottles don't exist and `--os` flag is not specified.
    return false
  end
  return true if arch.present?
  return true if bottle_tag.present? && formula.bottled?(bottle_tag)

  bottle.present? &&
    formula.pour_bottle? &&
    build_from_source_formulae.exclude?(formula.full_name) &&
    bottle.compatible_locations?
end