bottle: only chdir into the cellar when tarring up the bottle
This commit is contained in:
parent
b6f8649496
commit
07006bfdd4
@ -127,64 +127,60 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
bottle_path = Pathname.pwd/filename
|
bottle_path = Pathname.pwd/filename
|
||||||
sha1 = nil
|
|
||||||
|
|
||||||
prefix = HOMEBREW_PREFIX.to_s
|
prefix = HOMEBREW_PREFIX.to_s
|
||||||
cellar = HOMEBREW_CELLAR.to_s
|
cellar = HOMEBREW_CELLAR.to_s
|
||||||
|
|
||||||
output = nil
|
ohai "Bottling #{filename}..."
|
||||||
|
|
||||||
HOMEBREW_CELLAR.cd do
|
keg = Keg.new(f.prefix)
|
||||||
ohai "Bottling #{filename}..."
|
relocatable = false
|
||||||
|
|
||||||
keg = Keg.new(f.prefix)
|
keg.lock do
|
||||||
relocatable = false
|
begin
|
||||||
|
keg.relocate_install_names prefix, Keg::PREFIX_PLACEHOLDER,
|
||||||
keg.lock do
|
cellar, Keg::CELLAR_PLACEHOLDER, :keg_only => f.keg_only?
|
||||||
begin
|
|
||||||
keg.relocate_install_names prefix, Keg::PREFIX_PLACEHOLDER,
|
|
||||||
cellar, Keg::CELLAR_PLACEHOLDER, :keg_only => f.keg_only?
|
|
||||||
|
|
||||||
|
HOMEBREW_CELLAR.cd do
|
||||||
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
|
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
|
||||||
# or an uncompressed tarball (and more bandwidth friendly).
|
# or an uncompressed tarball (and more bandwidth friendly).
|
||||||
safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.version}"
|
safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.version}"
|
||||||
|
end
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
if prefix == '/usr/local'
|
if prefix == '/usr/local'
|
||||||
prefix_check = HOMEBREW_PREFIX/'opt'
|
prefix_check = HOMEBREW_PREFIX/'opt'
|
||||||
else
|
else
|
||||||
prefix_check = HOMEBREW_PREFIX
|
prefix_check = HOMEBREW_PREFIX
|
||||||
end
|
end
|
||||||
|
|
||||||
relocatable = !keg_contains(prefix_check, keg)
|
relocatable = !keg_contains(prefix_check, keg)
|
||||||
relocatable = !keg_contains(HOMEBREW_CELLAR, keg) && relocatable
|
relocatable = !keg_contains(HOMEBREW_CELLAR, keg) && relocatable
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
|
ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
|
||||||
raise
|
raise
|
||||||
ensure
|
ensure
|
||||||
ignore_interrupts do
|
ignore_interrupts do
|
||||||
keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, prefix,
|
keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, prefix,
|
||||||
Keg::CELLAR_PLACEHOLDER, cellar, :keg_only => f.keg_only?
|
Keg::CELLAR_PLACEHOLDER, cellar, :keg_only => f.keg_only?
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sha1 = bottle_path.sha1
|
|
||||||
|
|
||||||
bottle = Bottle.new
|
|
||||||
bottle.prefix HOMEBREW_PREFIX
|
|
||||||
bottle.cellar relocatable ? :any : HOMEBREW_CELLAR
|
|
||||||
bottle.revision bottle_revision
|
|
||||||
bottle.sha1 sha1 => bottle_tag
|
|
||||||
|
|
||||||
puts "./#{filename}"
|
|
||||||
output = bottle_output bottle
|
|
||||||
puts output
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bottle = Bottle.new
|
||||||
|
bottle.prefix HOMEBREW_PREFIX
|
||||||
|
bottle.cellar relocatable ? :any : HOMEBREW_CELLAR
|
||||||
|
bottle.revision bottle_revision
|
||||||
|
bottle.sha1 bottle_path.sha1 => bottle_tag
|
||||||
|
|
||||||
|
output = bottle_output bottle
|
||||||
|
|
||||||
|
puts "./#{filename}"
|
||||||
|
puts output
|
||||||
|
|
||||||
if ARGV.include? '--rb'
|
if ARGV.include? '--rb'
|
||||||
bottle_base = filename.gsub(bottle_suffix(bottle_revision), '')
|
bottle_base = filename.gsub(bottle_suffix(bottle_revision), '')
|
||||||
File.open "#{bottle_base}.bottle.rb", 'w' do |file|
|
File.open "#{bottle_base}.bottle.rb", 'w' do |file|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user