brew/Library/Homebrew/fetch.rb
Mike McQuaid 0f9bad0052
Fix bottle prefix and repository handling
We were previously only looking at the `cellar` value when pouring
bottles and ignoring the `prefix` and (implicit) `repository`.

Actually look at these values and set the defaults for each platform.

Also, when we're relocating to create or pour bottles when `prefix`
and `repository` are equal then skip relocating the `repository` and
always use references to the `prefix` instead.

Fixes #9453
2020-12-09 13:53:10 +00:00

22 lines
499 B
Ruby

# typed: true
# frozen_string_literal: true
module Homebrew
# @api private
module Fetch
extend T::Sig
sig { params(f: Formula, args: CLI::Args).returns(T::Boolean) }
def fetch_bottle?(f, args:)
bottle = f.bottle
return true if args.force_bottle? && bottle
return false unless bottle && f.pour_bottle?
return false if args.build_from_source_formulae.include?(f.full_name)
return false unless bottle.compatible_locations?
true
end
end
end