diff options
| author | Jack Nagel | 2013-12-04 22:37:57 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-12-04 22:37:57 -0600 |
| commit | 1623b9ef3ca5f9e8a7105cc9a73f1ec3040315d3 (patch) | |
| tree | 817697fb94c25f466c659bb4f931f44fcae0e24b /Library/Homebrew/cmd | |
| parent | 1a3eb21379f3a64cfeec5d67a54efdd3f4e24620 (diff) | |
| download | homebrew-1623b9ef3ca5f9e8a7105cc9a73f1ec3040315d3.tar.bz2 | |
Do relocation check while preparing bottle
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/bottle.rb | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 8331619f8..03e77d793 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -116,9 +116,7 @@ module Homebrew extend self sha1 = nil prefix = HOMEBREW_PREFIX.to_s - tmp_prefix = '/tmp' cellar = HOMEBREW_CELLAR.to_s - tmp_cellar = '/tmp/Cellar' output = nil @@ -126,6 +124,7 @@ module Homebrew extend self ohai "Bottling #{filename}..." keg = Keg.new(f.prefix) + relocatable = false keg.lock do begin @@ -135,6 +134,19 @@ module Homebrew extend self # 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}" + + 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 + + relocatable = !keg_contains(prefix_check, keg) + relocatable = !keg_contains(HOMEBREW_CELLAR, keg) if relocatable ensure keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, prefix, Keg::CELLAR_PLACEHOLDER, cellar, :keg_only => f.keg_only? @@ -142,30 +154,6 @@ module Homebrew extend self end sha1 = bottle_path.sha1 - relocatable = false - - if File.size?(bottle_path) > 1*1024*1024 - ohai "Detecting if #{filename} is relocatable..." - end - - keg.lock do - # Relocate bottle library references before testing for built-in - # references to the Cellar e.g. Qt's QMake annoyingly does this. - keg.relocate_install_names prefix, tmp_prefix, cellar, tmp_cellar, :keg_only => f.keg_only? - - 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) if relocatable - - # And do the same thing in reverse to change the library references - # back to how they were. - keg.relocate_install_names tmp_prefix, prefix, tmp_cellar, cellar - end bottle = Bottle.new bottle.prefix HOMEBREW_PREFIX |
