From e2d032a6b6c765e0a6311a84a7b70f5ddf12b665 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 18 Dec 2020 12:22:15 +0000 Subject: [PATCH] keg_relocate: ensure @@HOMEBREW_REPOSITORY@@ is always relocated. This will be needed to pour older bottles after 2.7.0. --- Library/Homebrew/keg_relocate.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 2446f76b26..1456854222 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -4,16 +4,15 @@ class Keg PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@" CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@" + REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@" LIBRARY_PLACEHOLDER = "@@HOMEBREW_LIBRARY@@" - # TODO: delete these after Homebrew 2.7.0 is released. - REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@" + # TODO: delete this after Homebrew 2.7.0 is released. REPOSITORY_LIBRARY_PLACEHOLDER = "#{REPOSITORY_PLACEHOLDER}/Library" - Relocation = Struct.new(:old_prefix, :old_cellar, :old_library, - :new_prefix, :new_cellar, :new_library, + Relocation = Struct.new(:old_prefix, :old_cellar, :old_repository, :old_library, + :new_prefix, :new_cellar, :new_repository, :new_library, # TODO: delete these after Homebrew 2.7.0 is released. - :old_repository, :new_repository, :old_repository_library, :new_repository_library) do # Use keyword args instead of positional args for initialization. def initialize(**kwargs) @@ -65,13 +64,13 @@ class Keg relocation = Relocation.new( old_prefix: PREFIX_PLACEHOLDER, old_cellar: CELLAR_PLACEHOLDER, + old_repository: REPOSITORY_PLACEHOLDER, old_library: LIBRARY_PLACEHOLDER, new_prefix: HOMEBREW_PREFIX.to_s, new_cellar: HOMEBREW_CELLAR.to_s, + new_repository: HOMEBREW_REPOSITORY.to_s, new_library: HOMEBREW_LIBRARY.to_s, # TODO: delete these after Homebrew 2.7.0 is released. - old_repository: REPOSITORY_PLACEHOLDER, - new_repository: HOMEBREW_REPOSITORY.to_s, old_repository_library: REPOSITORY_LIBRARY_PLACEHOLDER, new_repository_library: HOMEBREW_LIBRARY.to_s, ) @@ -95,7 +94,6 @@ class Keg }.compact # when HOMEBREW_PREFIX == HOMEBREW_REPOSITORY we should use HOMEBREW_PREFIX for all relocations to avoid # being unable to differentiate between them. - # TODO: delete this after Homebrew 2.7.0 is released. replacements[relocation.old_repository] = relocation.new_repository if HOMEBREW_PREFIX != HOMEBREW_REPOSITORY changed = s.gsub!(Regexp.union(replacements.keys.sort_by(&:length).reverse), replacements) next unless changed