mac/formula_cellar_checks: apply suggestions from code review

- Fix missing space
- use `MachO::Utils.fat_magic?`
- call `#flag?` consistently.

Co-authored-by: Bo Anderson <mail@boanderson.me>
This commit is contained in:
Carlo Cabrera 2021-10-13 16:54:02 +08:00 committed by GitHub
parent 4fbe0a2b1b
commit e8eb781470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ module FormulaCellarChecks
These object files were linked against the deprecated system OpenSSL or These object files were linked against the deprecated system OpenSSL or
the system's private LibreSSL. the system's private LibreSSL.
Adding `depends_on "openssl"` to the formula may help. Adding `depends_on "openssl"` to the formula may help.
#{system_openssl * "\n "} #{system_openssl * "\n "}
EOS EOS
end end
@ -97,10 +97,10 @@ module FormulaCellarChecks
next true unless file.dylib? next true unless file.dylib?
macho = MachO.open(file) macho = MachO.open(file)
if file.universal? if MachO::Utils.fat_magic?(macho.magic)
macho.machos.map(&:header).all? { |h| h.flag? :MH_TWOLEVEL } macho.machos.map(&:header).all? { |h| h.flag? :MH_TWOLEVEL }
else else
macho.header.flag?(:MH_TWOLEVEL) macho.header.flag? :MH_TWOLEVEL
end end
end end
return if flat_namespace_files.empty? return if flat_namespace_files.empty?