Merge pull request #11760 from carlocab/show-archs
formula_cellar_checks: show mismatched arch in `check_binary_arches`
This commit is contained in:
commit
ca4f7aeb00
@ -320,14 +320,16 @@ module FormulaCellarChecks
|
|||||||
return if !OS.mac? && !OS.linux?
|
return if !OS.mac? && !OS.linux?
|
||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
mismatches = keg.binary_executable_or_library_files.reject do |file|
|
mismatches = {}
|
||||||
file.arch == Hardware::CPU.arch
|
keg.binary_executable_or_library_files.each do |file|
|
||||||
|
farch = file.arch
|
||||||
|
mismatches[file] = farch unless farch == Hardware::CPU.arch
|
||||||
end
|
end
|
||||||
return if mismatches.empty?
|
return if mismatches.empty?
|
||||||
|
|
||||||
compatible_universal_binaries, mismatches = mismatches.partition do |file|
|
compatible_universal_binaries, mismatches = mismatches.partition do |file, arch|
|
||||||
file.arch == :universal && file.archs.include?(Hardware::CPU.arch)
|
arch == :universal && file.archs.include?(Hardware::CPU.arch)
|
||||||
end
|
end.map(&:to_h) # To prevent transformation into nested arrays
|
||||||
|
|
||||||
universal_binaries_expected = if formula.tap.present? && formula.tap.core_tap?
|
universal_binaries_expected = if formula.tap.present? && formula.tap.core_tap?
|
||||||
tap_audit_exception(:universal_binary_allowlist, formula.name)
|
tap_audit_exception(:universal_binary_allowlist, formula.name)
|
||||||
@ -340,9 +342,9 @@ module FormulaCellarChecks
|
|||||||
|
|
||||||
if mismatches.present?
|
if mismatches.present?
|
||||||
s += <<~EOS
|
s += <<~EOS
|
||||||
Binaries built for an incompatible architecture were installed into #{formula}'s prefix.
|
Binaries built for a non-native architecture were installed into #{formula}'s prefix.
|
||||||
The offending files are:
|
The offending files are:
|
||||||
#{mismatches * "\n "}
|
#{mismatches.map { |m| "#{m.first}\t(#{m.last})" } * "\n "}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -350,7 +352,7 @@ module FormulaCellarChecks
|
|||||||
s += <<~EOS
|
s += <<~EOS
|
||||||
Unexpected universal binaries were found.
|
Unexpected universal binaries were found.
|
||||||
The offending files are:
|
The offending files are:
|
||||||
#{compatible_universal_binaries * "\n "}
|
#{compatible_universal_binaries.keys * "\n "}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user