relocate_install_names: use a single ensure_writable block

This commit is contained in:
Jack Nagel 2013-12-04 22:37:57 -06:00
parent cf4e159d53
commit ca01b0ad97

View File

@ -21,17 +21,15 @@ class Keg
def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, options={} def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, options={}
mach_o_files.each do |file| mach_o_files.each do |file|
install_names_for(file, options, relocate_reject_proc(old_cellar)) do |id, old_cellar_names|
file.ensure_writable do file.ensure_writable do
install_names_for(file, options, relocate_reject_proc(old_cellar)) do |id, old_cellar_names|
old_cellar_names.each do |old_cellar_name| old_cellar_names.each do |old_cellar_name|
new_cellar_name = old_cellar_name.gsub(old_cellar, new_cellar) new_cellar_name = old_cellar_name.gsub(old_cellar, new_cellar)
change_install_name(old_cellar_name, new_cellar_name, file) change_install_name(old_cellar_name, new_cellar_name, file)
end end
end end
end
install_names_for(file, options, relocate_reject_proc(old_prefix)) do |id, old_prefix_names| install_names_for(file, options, relocate_reject_proc(old_prefix)) do |id, old_prefix_names|
file.ensure_writable do
change_dylib_id(id.gsub(old_prefix, new_prefix), file) if file.dylib? change_dylib_id(id.gsub(old_prefix, new_prefix), file) if file.dylib?
old_prefix_names.each do |old_prefix_name| old_prefix_names.each do |old_prefix_name|