Skip to content
Snippets Groups Projects
Commit e4fb2ce3 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #1015 from MikeMcQuaid/relocate-repository

Relocate HOMEBREW_REPOSITORY when necessary.
parents 8e9a9b64 997ccb04
No related branches found
No related tags found
No related merge requests found
......@@ -177,6 +177,7 @@ module Homebrew
tar_path = Pathname.pwd/tar_filename
prefix = HOMEBREW_PREFIX.to_s
repository = HOMEBREW_REPOSITORY.to_s
cellar = HOMEBREW_CELLAR.to_s
ohai "Bottling #{filename}..."
......@@ -193,7 +194,8 @@ module Homebrew
keg.relocate_dynamic_linkage prefix, Keg::PREFIX_PLACEHOLDER,
cellar, Keg::CELLAR_PLACEHOLDER
keg.relocate_text_files prefix, Keg::PREFIX_PLACEHOLDER,
cellar, Keg::CELLAR_PLACEHOLDER
cellar, Keg::CELLAR_PLACEHOLDER,
repository, Keg::REPOSITORY_PLACEHOLDER
end
keg.delete_pyc_files!
......@@ -248,6 +250,7 @@ module Homebrew
skip_relocation = true
else
relocatable = false if keg_contain?(prefix_check, keg, ignores)
relocatable = false if keg_contain?(repository, keg, ignores)
relocatable = false if keg_contain?(cellar, keg, ignores)
if prefix != prefix_check
relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg)
......@@ -265,7 +268,8 @@ module Homebrew
keg.relocate_dynamic_linkage Keg::PREFIX_PLACEHOLDER, prefix,
Keg::CELLAR_PLACEHOLDER, cellar
keg.relocate_text_files Keg::PREFIX_PLACEHOLDER, prefix,
Keg::CELLAR_PLACEHOLDER, cellar
Keg::CELLAR_PLACEHOLDER, cellar,
Keg::REPOSITORY_PLACEHOLDER, repository
end
end
end
......
......@@ -779,7 +779,8 @@ class FormulaInstaller
Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s
end
keg.relocate_text_files Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s
Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s,
Keg::REPOSITORY_PLACEHOLDER, HOMEBREW_REPOSITORY.to_s
Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path|
path.extend(InstallRenamed)
......
class Keg
PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@".freeze
CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@".freeze
REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@".freeze
def fix_dynamic_linkage
symlink_files.each do |file|
......@@ -18,13 +19,15 @@ class Keg
[]
end
def relocate_text_files(old_prefix, new_prefix, old_cellar, new_cellar)
def relocate_text_files(old_prefix, new_prefix, old_cellar, new_cellar,
old_repository, new_repository)
files = text_files | libtool_files
files.group_by { |f| f.stat.ino }.each_value do |first, *rest|
s = first.open("rb", &:read)
changed = s.gsub!(old_cellar, new_cellar)
changed = s.gsub!(old_prefix, new_prefix) || changed
changed = s.gsub!(old_repository, new_repository) || changed
next unless changed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment