aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-12-12 19:46:37 -0600
committerJack Nagel2013-12-12 19:46:37 -0600
commitd272e3c9aa9bdd50c383f24ab281b2055a3655f7 (patch)
treebfccbfae1e1769bfd2614dd70e5c441c5cfbfd27
parentd396454de3e618876badd97178721f7fcd3d2390 (diff)
downloadhomebrew-d272e3c9aa9bdd50c383f24ab281b2055a3655f7.tar.bz2
bottle: only chdir into the cellar when tarring up the bottle
-rw-r--r--Library/Homebrew/cmd/bottle.rb74
1 files changed, 35 insertions, 39 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 36e75d079..935ca149e 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -127,63 +127,59 @@ module Homebrew extend self
end
bottle_path = Pathname.pwd/filename
- sha1 = nil
prefix = HOMEBREW_PREFIX.to_s
cellar = HOMEBREW_CELLAR.to_s
- output = nil
+ ohai "Bottling #{filename}..."
- HOMEBREW_CELLAR.cd do
- ohai "Bottling #{filename}..."
+ keg = Keg.new(f.prefix)
+ relocatable = false
- keg = Keg.new(f.prefix)
- relocatable = false
-
- keg.lock do
- begin
- keg.relocate_install_names prefix, Keg::PREFIX_PLACEHOLDER,
- cellar, Keg::CELLAR_PLACEHOLDER, :keg_only => f.keg_only?
+ keg.lock do
+ 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
# or an uncompressed tarball (and more bandwidth friendly).
safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.version}"
+ end
- if File.size?(bottle_path) > 1*1024*1024
- ohai "Detecting if #{filename} is relocatable..."
- end
+ if File.size?(bottle_path) > 1*1024*1024
+ ohai "Detecting if #{filename} is relocatable..."
+ end
- if prefix == '/usr/local'
- prefix_check = HOMEBREW_PREFIX/'opt'
- else
- prefix_check = HOMEBREW_PREFIX
- end
+ if prefix == '/usr/local'
+ prefix_check = HOMEBREW_PREFIX/'opt'
+ else
+ prefix_check = HOMEBREW_PREFIX
+ end
- relocatable = !keg_contains(prefix_check, keg)
- relocatable = !keg_contains(HOMEBREW_CELLAR, keg) && relocatable
- rescue Interrupt
- ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
- raise
- ensure
- ignore_interrupts do
- keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, prefix,
- Keg::CELLAR_PLACEHOLDER, cellar, :keg_only => f.keg_only?
- end
+ relocatable = !keg_contains(prefix_check, keg)
+ relocatable = !keg_contains(HOMEBREW_CELLAR, keg) && relocatable
+ rescue Interrupt
+ ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
+ raise
+ ensure
+ ignore_interrupts do
+ keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, prefix,
+ Keg::CELLAR_PLACEHOLDER, cellar, :keg_only => f.keg_only?
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 bottle_path.sha1 => bottle_tag
- bottle = Bottle.new
- bottle.prefix HOMEBREW_PREFIX
- bottle.cellar relocatable ? :any : HOMEBREW_CELLAR
- bottle.revision bottle_revision
- bottle.sha1 sha1 => bottle_tag
+ output = bottle_output bottle
- puts "./#{filename}"
- output = bottle_output bottle
- puts output
- end
+ puts "./#{filename}"
+ puts output
if ARGV.include? '--rb'
bottle_base = filename.gsub(bottle_suffix(bottle_revision), '')