From e23cca8d844971eb4743f4222ddc95b7a2077757 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 11 Sep 2015 19:13:52 +0800 Subject: [PATCH] bottle: auto detect any_skip_relocation --- Library/Homebrew/cmd/bottle.rb | 13 ++++++++++++- Library/Homebrew/keg_relocate.rb | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 3a95759cde..961e44d17b 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 7a2636dff7..70ce8f5153 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.