Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Library/Homebrew/extend/os/linux/keg_relocate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def change_rpath!(file, old_prefix, new_prefix, skip_protodesc_cold: false)
old_interpreter.sub old_prefix, new_prefix
end
updated[:interpreter] = new_interpreter if old_interpreter != new_interpreter
return false if updated.empty?

file.patch!(interpreter: updated[:interpreter], rpath: updated[:rpath])
require_relocation!
true
Comment thread
MikeMcQuaid marked this conversation as resolved.
end

Expand Down
13 changes: 3 additions & 10 deletions Library/Homebrew/extend/os/mac/keg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,11 @@ def must_be_writable_directories
end
end

sig { params(path: ::Pathname).void }
def initialize(path)
super

@require_relocation = T.let(false, T::Boolean)
end

sig { params(id: String, file: MachOShim).returns(T::Boolean) }
def change_dylib_id(id, file)
return false if file.dylib_id == id

@require_relocation = true
require_relocation!
odebug "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}"
file.change_dylib_id(id, strict: false)
true
Expand All @@ -67,7 +60,7 @@ def change_dylib_id(id, file)
def change_install_name(old, new, file)
return false if old == new

@require_relocation = true
require_relocation!
odebug "Changing install name in #{file}\n from #{old}\n to #{new}"
file.change_install_name(old, new, strict: false)
true
Expand All @@ -84,7 +77,7 @@ def change_install_name(old, new, file)
def change_rpath(old, new, file)
return false if old == new

@require_relocation = true
require_relocation!
odebug "Changing rpath in #{file}\n from #{old}\n to #{new}"
file.change_rpath(old, new, strict: false)
true
Expand Down
7 changes: 6 additions & 1 deletion Library/Homebrew/keg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def initialize(path)
@linked_keg_record = T.let(HOMEBREW_LINKED_KEGS/name, Pathname)
@opt_record = T.let(HOMEBREW_PREFIX/"opt/#{name}", Pathname)
@oldname_opt_records = T.let([], T::Array[Pathname])
@require_relocation = false
@require_relocation = T.let(false, T::Boolean)
end

sig { returns(Pathname) }
Expand Down Expand Up @@ -259,6 +259,11 @@ def empty_installation?
sig { returns(T::Boolean) }
def require_relocation? = @require_relocation

sig { void }
def require_relocation!
@require_relocation = true
end

sig { returns(T::Boolean) }
def linked?
linked_keg_record.symlink? &&
Expand Down
Loading