diff options
| author | William Woodruff | 2016-11-07 19:37:52 -0500 |
|---|---|---|
| committer | William Woodruff | 2016-11-09 17:35:56 -0500 |
| commit | 032ed07bce6ec15ae24bb9e6989fd1ab8ecc27ce (patch) | |
| tree | 4156b958f4fbe1d9c0f3047e0ee4e30723eebf4f /Library/Homebrew/os | |
| parent | 7e09379669b8288f280ddf84e2a10a9cf349d038 (diff) | |
| download | brew-032ed07bce6ec15ae24bb9e6989fd1ab8ecc27ce.tar.bz2 | |
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.
Diffstat (limited to 'Library/Homebrew/os')
| -rw-r--r-- | Library/Homebrew/os/mac/linkage_checker.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/mach.rb | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Library/Homebrew/os/mac/linkage_checker.rb b/Library/Homebrew/os/mac/linkage_checker.rb index e014e3816..e72227fc4 100644 --- a/Library/Homebrew/os/mac/linkage_checker.rb +++ b/Library/Homebrew/os/mac/linkage_checker.rb @@ -23,7 +23,10 @@ class LinkageChecker @keg.find do |file| next if file.symlink? || file.directory? 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 if dylib.start_with? "@" @variable_dylibs << dylib diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/mach.rb index 07598a23d..44c5ee50a 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/mach.rb @@ -51,8 +51,10 @@ module MachO end end - def dynamically_linked_libraries - macho.linked_dylibs + def dynamically_linked_libraries(except: :none) + lcs = macho.dylib_load_commands.reject { |lc| lc.type == except } + + lcs.map(&:name).map(&:to_s) end def dylib_id |
