From 831d034303bf972f6b4a872d5abdf6acb3439656 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 15 Dec 2020 11:32:10 +0000 Subject: [PATCH] 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. --- Library/Homebrew/software_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index cd762675a9..054f7cefbe 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -369,16 +369,18 @@ class BottleSpecification end def compatible_locations? - compatible_cellar = cellar == :any || - cellar == :any_skip_relocation || - cellar == HOMEBREW_CELLAR.to_s + # this looks like it should check prefix and repository too but to be + # `cellar :any` actually requires no references to the cellar, prefix or + # repository. + return true if [:any, :any_skip_relocation].include?(cellar) + compatible_cellar = cellar == HOMEBREW_CELLAR.to_s compatible_prefix = prefix == HOMEBREW_PREFIX.to_s # Only check the repository matches if the prefix is the default. # This is because the bottle DSL does not allow setting a custom repository # 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 else true