linkage_checker: skip files with incompatible architectures
Some formulae include these files, and they can't always be removed. However, they can cause spurious linkage failures, so let's skip them when checking for linkage. See, for example, faust at Homebrew/homebrew-core#191308.
This commit is contained in:
parent
69ff6c4735
commit
861d7b9087
@ -469,6 +469,11 @@ class Pathname
|
||||
false
|
||||
end
|
||||
|
||||
sig { params(_wanted_arch: Symbol).returns(T::Boolean) }
|
||||
def arch_compatible?(_wanted_arch)
|
||||
false
|
||||
end
|
||||
|
||||
sig { returns(T::Array[String]) }
|
||||
def rpaths
|
||||
[]
|
||||
|
||||
@ -115,6 +115,7 @@ class LinkageChecker
|
||||
@keg.find do |file|
|
||||
next if file.symlink? || file.directory?
|
||||
next if !file.dylib? && !file.binary_executable? && !file.mach_o_bundle?
|
||||
next unless file.arch_compatible?(Hardware::CPU.arch)
|
||||
|
||||
# weakly loaded dylibs may not actually exist on disk, so skip them
|
||||
# when checking for broken linkage
|
||||
|
||||
@ -68,6 +68,12 @@ module ELFShim
|
||||
end
|
||||
end
|
||||
|
||||
def arch_compatible?(wanted_arch)
|
||||
return true unless elf?
|
||||
|
||||
wanted_arch == arch
|
||||
end
|
||||
|
||||
def elf_type
|
||||
return :dunno unless elf?
|
||||
|
||||
|
||||
@ -155,6 +155,13 @@ module MachOShim
|
||||
arch == :ppc64
|
||||
end
|
||||
|
||||
def arch_compatible?(wanted_arch)
|
||||
return true unless mach_data.present?
|
||||
return arch == wanted_arch unless universal?
|
||||
|
||||
archs.include?(wanted_arch)
|
||||
end
|
||||
|
||||
def dylib?
|
||||
mach_data.any? { |m| m.fetch(:type) == :dylib }
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user