From e8da9613fbe21a409e85af56319ce13c33daffcf Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Wed, 27 Sep 2017 02:08:23 -0700 Subject: Revert "mach: Avoid reopening the file for relocation" --- Library/Homebrew/os/mac.rb | 1 + Library/Homebrew/os/mac/keg.rb | 29 +++++++++++++++++++++++++++++ Library/Homebrew/os/mac/mach.rb | 28 ---------------------------- 3 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 Library/Homebrew/os/mac/keg.rb (limited to 'Library/Homebrew/os') diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index e8c92a607..15c301f99 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -5,6 +5,7 @@ require "os/mac/xcode" require "os/mac/xquartz" require "os/mac/pathname" require "os/mac/sdk" +require "os/mac/keg" module OS module Mac diff --git a/Library/Homebrew/os/mac/keg.rb b/Library/Homebrew/os/mac/keg.rb new file mode 100644 index 000000000..6caadb1d7 --- /dev/null +++ b/Library/Homebrew/os/mac/keg.rb @@ -0,0 +1,29 @@ +class Keg + def change_dylib_id(id, file) + return if file.dylib_id == id + @require_relocation = true + puts "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}" if ARGV.debug? + MachO::Tools.change_dylib_id(file, id, strict: false) + rescue MachO::MachOError + onoe <<-EOS.undent + Failed changing dylib ID of #{file} + from #{file.dylib_id} + to #{id} + EOS + raise + end + + def change_install_name(old, new, file) + return if old == new + @require_relocation = true + puts "Changing install name in #{file}\n from #{old}\n to #{new}" if ARGV.debug? + MachO::Tools.change_install_name(file, old, new, strict: false) + rescue MachO::MachOError + onoe <<-EOS.undent + Failed changing install name in #{file} + from #{old} + to #{new} + EOS + raise + end +end diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/mach.rb index 29273cbaa..9b53c4979 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/mach.rb @@ -61,34 +61,6 @@ module MachOShim macho.dylib_id end - def change_dylib_id(id) - return if dylib_id == id - puts "Changing dylib ID of #{self}\n from #{dylib_id}\n to #{id}" if ARGV.debug? - macho.change_dylib_id(id, strict: false) - macho.write! - rescue MachO::MachOError - odie <<-EOS.undent - Failed changing dylib ID of #{self} - from #{file.dylib_id} - to #{id} - EOS - raise - end - - def change_install_name(old, new) - return if old == new - puts "Changing install name in #{self}\n from #{old}\n to #{new}" if ARGV.debug? - macho.change_install_name(old, new, strict: false) - macho.write! - rescue MachO::MachOError - odie <<-EOS.undent - Failed changing install name in #{self} - from #{old} - to #{new} - EOS - raise - end - def archs mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension) end -- cgit v1.2.3