keg_relocate: ensure @@HOMEBREW_REPOSITORY@@ is always relocated.
This will be needed to pour older bottles after 2.7.0.
This commit is contained in:
parent
0bbf965807
commit
e2d032a6b6
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user