aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-05-22 11:11:21 -0500
committerJack Nagel2013-05-22 11:11:32 -0500
commit2488cfa55a63cbe12400064a0af0576512520dcb (patch)
tree40c458a98bafab4a9236dec39ac47f136a7735fa /Library
parenta69552a57d9758edd206cb45b9d25365fcdcbf42 (diff)
downloadbrew-2488cfa55a63cbe12400064a0af0576512520dcb.tar.bz2
Factor out MacOS.locate("install_name_tool") calls
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg_fix_install_names.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb
index bdb98286f..b3fa01604 100644
--- a/Library/Homebrew/keg_fix_install_names.rb
+++ b/Library/Homebrew/keg_fix_install_names.rb
@@ -4,23 +4,23 @@ class Keg
mach_o_files.each do |file|
install_names_for file do |id, bad_names|
file.ensure_writable do
- system MacOS.locate("install_name_tool"), "-id", id, file if file.dylib?
+ install_name_tool("-id", id, file) if file.dylib?
bad_names.each do |bad_name|
# 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.
if file.dylib? or file.mach_o_bundle? and (file.parent + bad_name).exist?
- system MacOS.locate("install_name_tool"), "-change", bad_name, "@loader_path/#{bad_name}", file
+ install_name_tool("-change", bad_name, "@loader_path/#{bad_name}", file)
elsif file.mach_o_executable? and (lib/bad_name).exist?
- system MacOS.locate("install_name_tool"), "-change", bad_name, "#{lib}/#{bad_name}", file
+ install_name_tool("-change", bad_name, "#{lib}/#{bad_name}", file)
else
# Otherwise, try and locate the dylib by walking the entire
# lib tree recursively.
abs_name = find_dylib(Pathname.new(bad_name).basename)
if abs_name and abs_name.exist?
- system MacOS.locate("install_name_tool"), "-change", bad_name, abs_name, file
+ install_name_tool("-change", bad_name, abs_name, file)
else
opoo "Could not fix install names for #{file}"
end
@@ -36,11 +36,11 @@ class Keg
install_names_for(file, relocate_reject_proc(old_prefix)) do |id, old_prefix_names|
file.ensure_writable do
new_prefix_id = id.to_s.gsub old_prefix, new_prefix
- system MacOS.locate("install_name_tool"), "-id", new_prefix_id, file if file.dylib?
+ install_name_tool("-id", new_prefix_id, file) if file.dylib?
old_prefix_names.each do |old_prefix_name|
new_prefix_name = old_prefix_name.to_s.gsub old_prefix, new_prefix
- system MacOS.locate("install_name_tool"), "-change", old_prefix_name, new_prefix_name, file
+ install_name_tool("-change", old_prefix_name, new_prefix_name, file)
end
end
end
@@ -49,7 +49,7 @@ class Keg
file.ensure_writable do
old_cellar_names.each do |old_cellar_name|
new_cellar_name = old_cellar_name.to_s.gsub old_cellar, new_cellar
- system MacOS.locate("install_name_tool"), "-change", old_cellar_name, new_cellar_name, file
+ install_name_tool("-change", old_cellar_name, new_cellar_name, file)
end
end
end
@@ -60,6 +60,10 @@ class Keg
OTOOL_RX = /\t(.*) \(compatibility version (\d+\.)*\d+, current version (\d+\.)*\d+\)/
+ def install_name_tool(*args)
+ system(MacOS.locate("install_name_tool"), *args)
+ end
+
def lib; join 'lib' end
def default_reject_proc