Merge pull request #17577 from SMillerDev/feat/audit/check_cask_binary_32_bit

This commit is contained in:
Sean Molenaar 2024-06-28 09:48:39 +02:00 committed by GitHub
commit a40f32776f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -580,13 +580,20 @@ module Cask
add_error "No binaries in App: #{artifact.source}", location: cask.url.location if files.empty? add_error "No binaries in App: #{artifact.source}", location: cask.url.location if files.empty?
system_command("lipo", args: ["-archs", files.first], print_stderr: false) system_command("lipo", args: ["-archs", files.first], print_stderr: false)
when Artifact::Binary when Artifact::Binary
system_command("lipo", args: ["-archs", path], print_stderr: false) binary_path = path.to_s.gsub(cask.appdir, tmpdir)
system_command("lipo", args: ["-archs", binary_path], print_stderr: true)
else else
add_error "Unknown artifact type: #{artifact.class}", location: cask.url.location add_error "Unknown artifact type: #{artifact.class}", location: cask.url.location
end end
unless result.success? # binary stanza can contain shell scripts, so we just continue if lipo fails.
add_error "Failed to determine artifact architecture!", location: cask.url.location next unless result.success?
odebug result.merged_output
unless /arm64|x86_64/.match?(result.merged_output)
add_error "Artifacts architecture is no longer supported by macOS!",
location: cask.url.location
next next
end end