Fix universal binary handling in check_flat_namespace

This commit is contained in:
Carlo Cabrera 2021-10-12 13:49:53 +08:00
parent 0484bfe820
commit 7223f8ef74
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -95,13 +95,14 @@ module FormulaCellarChecks
keg = Keg.new(formula.prefix)
flat_namespace_files = keg.mach_o_files.reject do |file|
next true unless file.dylib?
# FIXME: macho.header.flag? is not defined when macho
# is a universal binary.
next true if file.universal?
macho = MachO.open(file)
if file.universal?
macho.machos.map(&:header).all? { |h| h.flag? :MH_TWO_LEVEL }
else
macho.header.flag?(:MH_TWO_LEVEL)
end
end
return if flat_namespace_files.empty?
<<~EOS