diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 0ea9544b33..47479d35d3 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -5,9 +5,10 @@ class Keg PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@" CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@" REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@" + LIBRARY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@/Library" - Relocation = Struct.new(:old_prefix, :old_cellar, :old_repository, - :new_prefix, :new_cellar, :new_repository) do + Relocation = Struct.new(:old_prefix, :old_cellar, :old_repository, :old_library, + :new_prefix, :new_cellar, :new_repository, :new_library) do # Use keyword args instead of positional args for initialization. def initialize(**kwargs) super(*members.map { |k| kwargs[k] }) @@ -40,9 +41,11 @@ class Keg old_prefix: HOMEBREW_PREFIX.to_s, old_cellar: HOMEBREW_CELLAR.to_s, old_repository: HOMEBREW_REPOSITORY.to_s, + old_library: HOMEBREW_LIBRARY.to_s, new_prefix: PREFIX_PLACEHOLDER, new_cellar: CELLAR_PLACEHOLDER, new_repository: REPOSITORY_PLACEHOLDER, + new_library: LIBRARY_PLACEHOLDER, ) relocate_dynamic_linkage(relocation) replace_text_in_files(relocation) @@ -53,9 +56,11 @@ class Keg 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, ) relocate_dynamic_linkage(relocation) unless skip_linkage replace_text_in_files(relocation, files: files) @@ -69,8 +74,9 @@ class Keg s = first.open("rb", &:read) replacements = { - relocation.old_prefix => relocation.new_prefix, - relocation.old_cellar => relocation.new_cellar, + relocation.old_prefix => relocation.new_prefix, + relocation.old_cellar => relocation.new_cellar, + relocation.old_library => relocation.new_library, } # when HOMEBREW_PREFIX == HOMEBREW_REPOSITORY we should use HOMEBREW_PREFIX for all relocations to avoid # being unable to differentiate between them.