software_spec: fix cellar any handling.

`cellar :any` actually requires no references to the cellar, prefix or
repository (not just cellar) so we can pour those bottles anywhere
regardless of the cellar, prefix or repository.
This commit is contained in:
Mike McQuaid 2020-12-15 11:32:10 +00:00
parent 61f9525974
commit 831d034303
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -369,16 +369,18 @@ class BottleSpecification
end end
def compatible_locations? def compatible_locations?
compatible_cellar = cellar == :any || # this looks like it should check prefix and repository too but to be
cellar == :any_skip_relocation || # `cellar :any` actually requires no references to the cellar, prefix or
cellar == HOMEBREW_CELLAR.to_s # repository.
return true if [:any, :any_skip_relocation].include?(cellar)
compatible_cellar = cellar == HOMEBREW_CELLAR.to_s
compatible_prefix = prefix == HOMEBREW_PREFIX.to_s compatible_prefix = prefix == HOMEBREW_PREFIX.to_s
# Only check the repository matches if the prefix is the default. # Only check the repository matches if the prefix is the default.
# This is because the bottle DSL does not allow setting a custom repository # This is because the bottle DSL does not allow setting a custom repository
# but does allow setting a custom prefix. # but does allow setting a custom prefix.
compatible_repository = if prefix == Homebrew::DEFAULT_PREFIX compatible_repository = if Homebrew.default_prefix?(prefix)
repository == HOMEBREW_REPOSITORY.to_s repository == HOMEBREW_REPOSITORY.to_s
else else
true true