aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-09-11 19:13:52 +0800
committerXu Cheng2015-09-12 01:39:00 +0800
commite23cca8d844971eb4743f4222ddc95b7a2077757 (patch)
tree7d48a82fc2915f81a4e88dead09c55de11411369 /Library
parentd911b5689a3e464f19b0756eb6eb4279d157cf53 (diff)
downloadbrew-e23cca8d844971eb4743f4222ddc95b7a2077757.tar.bz2
bottle: auto detect any_skip_relocation
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/bottle.rb13
-rw-r--r--Library/Homebrew/keg_relocate.rb5
2 files changed, 17 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 3a95759cd..961e44d17 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -164,6 +164,7 @@ module Homebrew
keg = Keg.new(f.prefix)
relocatable = false
+ skip_relocation = false
keg.lock do
begin
@@ -171,6 +172,7 @@ module Homebrew
cellar, Keg::CELLAR_PLACEHOLDER, :keg_only => f.keg_only?
keg.relocate_text_files prefix, Keg::PREFIX_PLACEHOLDER,
cellar, Keg::CELLAR_PLACEHOLDER
+
keg.delete_pyc_files!
cd cellar do
@@ -196,6 +198,7 @@ module Homebrew
relocatable = !keg_contains(prefix_check, keg, ignores)
relocatable = !keg_contains(cellar, keg, ignores) && relocatable
+ skip_relocation = relocatable && !keg.require_install_name_tool?
puts if !relocatable && ARGV.verbose?
rescue Interrupt
ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
@@ -215,7 +218,15 @@ module Homebrew
bottle = BottleSpecification.new
bottle.root_url(root_url) if root_url
bottle.prefix prefix
- bottle.cellar relocatable ? :any : cellar
+ if relocatable
+ if skip_relocation
+ bottle.cellar :any_skip_relocation
+ else
+ bottle.cellar :any
+ end
+ else
+ bottle.cellar cellar
+ end
bottle.revision bottle_revision
bottle.sha256 bottle_path.sha256 => bottle_tag
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index 7a2636dff..70ce8f515 100644
--- a/Library/Homebrew/keg_relocate.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -109,10 +109,15 @@ class Keg
end
def install_name_tool(*args)
+ @require_install_name_tool = true
tool = MacOS.install_name_tool
system(tool, *args) || raise(ErrorDuringExecution.new(tool, args))
end
+ def require_install_name_tool?
+ !!@require_install_name_tool
+ end
+
# If file is a dylib or bundle itself, look for the dylib named by
# bad_name relative to the lib directory, so that we can skip the more
# expensive recursive search if possible.