mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-15 19:56:59 +08:00
os/mac: Allow MachO.dynamically_linked_libraries to be filtered by dylib type.
This allows us to filter out weak linkages during audits, preventing a false error from occurring when the dylib cannot be found.
This commit is contained in:
parent
7e09379669
commit
032ed07bce
@ -23,7 +23,10 @@ class LinkageChecker
|
|||||||
@keg.find do |file|
|
@keg.find do |file|
|
||||||
next if file.symlink? || file.directory?
|
next if file.symlink? || file.directory?
|
||||||
next unless file.dylib? || file.mach_o_executable? || file.mach_o_bundle?
|
next unless file.dylib? || file.mach_o_executable? || file.mach_o_bundle?
|
||||||
file.dynamically_linked_libraries.each do |dylib|
|
|
||||||
|
# weakly loaded dylibs may not actually exist on disk, so skip them
|
||||||
|
# when checking for broken linkage
|
||||||
|
file.dynamically_linked_libraries(except: :LC_LOAD_WEAK_DYLIB).each do |dylib|
|
||||||
@reverse_links[dylib] << file
|
@reverse_links[dylib] << file
|
||||||
if dylib.start_with? "@"
|
if dylib.start_with? "@"
|
||||||
@variable_dylibs << dylib
|
@variable_dylibs << dylib
|
||||||
|
@ -51,8 +51,10 @@ module MachO
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def dynamically_linked_libraries
|
def dynamically_linked_libraries(except: :none)
|
||||||
macho.linked_dylibs
|
lcs = macho.dylib_load_commands.reject { |lc| lc.type == except }
|
||||||
|
|
||||||
|
lcs.map(&:name).map(&:to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dylib_id
|
def dylib_id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user