Insert placeholders for prefix and cellar in relocatable bottles

This commit is contained in:
Jack Nagel 2013-12-04 22:37:57 -06:00
parent 94ebe8e747
commit 76153e9780
2 changed files with 21 additions and 4 deletions

View File

@ -124,16 +124,30 @@ module Homebrew extend self
HOMEBREW_CELLAR.cd do HOMEBREW_CELLAR.cd do
ohai "Bottling #{filename}..." ohai "Bottling #{filename}..."
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
# or an uncompressed tarball (and more bandwidth friendly). keg = Keg.new(f.prefix)
safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.version}"
keg.lock do
begin
keg.relocate_install_names prefix, Keg::PREFIX_PLACEHOLDER,
cellar, Keg::CELLAR_PLACEHOLDER, :keg_only => f.keg_only?
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
# or an uncompressed tarball (and more bandwidth friendly).
safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.version}"
ensure
keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, prefix,
Keg::CELLAR_PLACEHOLDER, cellar, :keg_only => f.keg_only?
end
end
sha1 = bottle_path.sha1 sha1 = bottle_path.sha1
relocatable = false relocatable = false
if File.size?(bottle_path) > 1*1024*1024 if File.size?(bottle_path) > 1*1024*1024
ohai "Detecting if #{filename} is relocatable..." ohai "Detecting if #{filename} is relocatable..."
end end
keg = Keg.new f.prefix
keg.lock do keg.lock do
# Relocate bottle library references before testing for built-in # Relocate bottle library references before testing for built-in
# references to the Cellar e.g. Qt's QMake annoyingly does this. # references to the Cellar e.g. Qt's QMake annoyingly does this.

View File

@ -1,4 +1,7 @@
class Keg class Keg
PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@".freeze
CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@".freeze
def fix_install_names options={} def fix_install_names options={}
mach_o_files.each do |file| mach_o_files.each do |file|
install_names_for(file, options) do |id, bad_names| install_names_for(file, options) do |id, bad_names|