linkage: expand check to dylibs and bundles
This commit is contained in:
parent
caf310038f
commit
440adcbec0
@ -32,7 +32,7 @@ class LinkageChecker
|
|||||||
@unnecessary_deps = []
|
@unnecessary_deps = []
|
||||||
@unwanted_system_dylibs = []
|
@unwanted_system_dylibs = []
|
||||||
@version_conflict_deps = []
|
@version_conflict_deps = []
|
||||||
@executables_missing_rpaths = []
|
@files_missing_rpaths = []
|
||||||
|
|
||||||
check_dylibs(rebuild_cache: rebuild_cache)
|
check_dylibs(rebuild_cache: rebuild_cache)
|
||||||
end
|
end
|
||||||
@ -47,7 +47,7 @@ class LinkageChecker
|
|||||||
display_items "Undeclared dependencies with linkage", @undeclared_deps
|
display_items "Undeclared dependencies with linkage", @undeclared_deps
|
||||||
display_items "Dependencies with no linkage", @unnecessary_deps
|
display_items "Dependencies with no linkage", @unnecessary_deps
|
||||||
display_items "Unwanted system libraries", @unwanted_system_dylibs
|
display_items "Unwanted system libraries", @unwanted_system_dylibs
|
||||||
display_items "Executables with missing rpath", @executables_missing_rpaths
|
display_items "Files with missing rpath", @files_missing_rpaths
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_reverse_output
|
def display_reverse_output
|
||||||
@ -71,12 +71,12 @@ class LinkageChecker
|
|||||||
display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output
|
display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output
|
||||||
display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output
|
display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output
|
||||||
display_items "Undeclared dependencies with linkage", @undeclared_deps, puts_output: puts_output if strict
|
display_items "Undeclared dependencies with linkage", @undeclared_deps, puts_output: puts_output if strict
|
||||||
display_items "Executables with missing rpath", @executables_missing_rpaths, puts_output: puts_output
|
display_items "Files with missing rpath", @files_missing_rpaths, puts_output: puts_output
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(strict: T::Boolean).returns(T::Boolean) }
|
sig { params(strict: T::Boolean).returns(T::Boolean) }
|
||||||
def broken_library_linkage?(strict: false)
|
def broken_library_linkage?(strict: false)
|
||||||
issues = [@broken_deps, @unwanted_system_dylibs, @version_conflict_deps, @executables_missing_rpaths]
|
issues = [@broken_deps, @unwanted_system_dylibs, @version_conflict_deps, @files_missing_rpaths]
|
||||||
issues << @undeclared_deps if strict
|
issues << @undeclared_deps if strict
|
||||||
[issues, unexpected_broken_dylibs, unexpected_present_dylibs].flatten.any?(&:present?)
|
[issues, unexpected_broken_dylibs, unexpected_present_dylibs].flatten.any?(&:present?)
|
||||||
end
|
end
|
||||||
@ -159,12 +159,12 @@ class LinkageChecker
|
|||||||
dylibs.each do |dylib|
|
dylibs.each do |dylib|
|
||||||
@reverse_links[dylib] << file
|
@reverse_links[dylib] << file
|
||||||
|
|
||||||
# Binary executables that link @rpath-prefixed dylibs must include at
|
# Files that link @rpath-prefixed dylibs must include at
|
||||||
# least one rpath in order to resolve it.
|
# least one rpath in order to resolve it.
|
||||||
if !file_has_any_rpath_dylibs && (dylib.start_with? "@rpath/")
|
if !file_has_any_rpath_dylibs && (dylib.start_with? "@rpath/")
|
||||||
file_has_any_rpath_dylibs = true
|
file_has_any_rpath_dylibs = true
|
||||||
pathname = Pathname(file)
|
pathname = Pathname(file)
|
||||||
@executables_missing_rpaths << file if pathname.binary_executable? && pathname.rpaths.empty?
|
@files_missing_rpaths << file if pathname.rpaths.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
next if checked_dylibs.include? dylib
|
next if checked_dylibs.include? dylib
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user