Relocate HOMEBREW_LIBRARY conditionally

Relocate HOMEBREW_LIBRARY conditionally when
HOMEBREW_PREFIX = HOMEBREW_REPOSITORY.
This commit is contained in:
Shaun Jackman 2020-12-11 10:00:34 -08:00
parent 4edf28409d
commit 65b9e1231d

View File

@ -76,11 +76,14 @@ class Keg
replacements = {
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.
replacements[relocation.old_repository] = relocation.new_repository if HOMEBREW_PREFIX != HOMEBREW_REPOSITORY
if HOMEBREW_PREFIX == HOMEBREW_REPOSITORY
replacements[relocation.old_library] = relocation.new_library
else
replacements[relocation.old_repository] = relocation.new_repository
end
changed = s.gsub!(Regexp.union(replacements.keys.sort_by(&:length).reverse), replacements)
next unless changed