formula_installer: relocate bottle immediately after it's poured

Closes Homebrew/homebrew#42268.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-07-30 19:58:25 +08:00
parent 68b865fcb1
commit 8c7b629149

View File

@ -398,7 +398,7 @@ class FormulaInstaller
keg = Keg.new(formula.prefix) keg = Keg.new(formula.prefix)
link(keg) link(keg)
fix_install_names(keg) if OS.mac? fix_install_names(keg)
if build_bottle? && formula.post_install_defined? if build_bottle? && formula.post_install_defined?
ohai "Not running post_install as we're building a bottle" ohai "Not running post_install as we're building a bottle"
@ -580,11 +580,6 @@ class FormulaInstaller
def fix_install_names(keg) def fix_install_names(keg)
keg.fix_install_names(:keg_only => formula.keg_only?) keg.fix_install_names(:keg_only => formula.keg_only?)
if @poured_bottle
keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => formula.keg_only?
end
rescue Exception => e rescue Exception => e
onoe "Failed to fix install names" onoe "Failed to fix install names"
puts "The formula built, but you may encounter issues using it or linking other" puts "The formula built, but you may encounter issues using it or linking other"
@ -630,6 +625,10 @@ class FormulaInstaller
downloader.stage downloader.stage
end end
keg = Keg.new(formula.prefix)
keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => formula.keg_only?
Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path| Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path|
path.extend(InstallRenamed) path.extend(InstallRenamed)
path.cp_path_sub(formula.bottle_prefix, HOMEBREW_PREFIX) path.cp_path_sub(formula.bottle_prefix, HOMEBREW_PREFIX)