Implement ruby-macho TODOs

We now have the new release of ruby-macho (#15758), so we can now
finish off the remaining work from #15731.
This commit is contained in:
Carlo Cabrera 2023-07-26 11:15:19 +08:00
parent ccf0caffab
commit 6b728bf3bd
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0
2 changed files with 5 additions and 7 deletions

View File

@ -59,8 +59,6 @@ class Keg
new_name = opt_name_for(bad_name)
loader_name = loader_name_for(file, new_name)
next if loader_name == bad_name
# TODO: Remove the line below on the next release of ruby-macho. See Homebrew/ruby-macho@e9eaa75.
next if file.rpaths(resolve_variable_references: false).include?(loader_name)
change_rpath(bad_name, loader_name, file)
end

View File

@ -64,11 +64,11 @@ module MachOShim
resolve_variable_name(r.path.to_s) == resolve_variable_name(rpath)
end
# TODO: Add `last: true` to `options` and replace `delete_command` with `delete_rpath`
# when the PR linked below is merged and release for ruby-macho.
# https://github.com/Homebrew/ruby-macho/pull/555
command_to_delete = candidates.last # .path.to_s (when switching to `MachOFile#delete_rpath`)
macho.delete_command(command_to_delete, options)
# Delete the last instance to avoid changing the order in which rpaths are searched.
rpath_to_delete = candidates.last.path.to_s
options[:last] = true
macho.delete_rpath(rpath_to_delete, options)
macho.write!
end