Merge pull request #18109 from leipert/leipert-fix-rosetta-audit

This commit is contained in:
Mike McQuaid 2024-08-21 09:53:30 +01:00 committed by GitHub
commit b3082182f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -574,7 +574,11 @@ module Cask
File.executable?(f) && !File.directory?(f) && !f.end_with?(".dylib")
end
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)
main_binary = get_plist_main_binary(path)
main_binary ||= files.first
system_command("lipo", args: ["-archs", main_binary], print_stderr: false)
when Artifact::Binary
binary_path = path.to_s.gsub(cask.appdir, tmpdir)
system_command("lipo", args: ["-archs", binary_path], print_stderr: true)
@ -739,6 +743,17 @@ module Cask
end
end
sig { params(path: Pathname).returns(T.nilable(String)) }
def get_plist_main_binary(path)
return unless online?
plist_path = "#{path}/Contents/Info.plist"
return unless File.exist?(plist_path)
plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", plist_path]).plist
plist["CFBundleExecutable"].presence
end
sig { void }
def audit_github_prerelease_version
odebug "Auditing GitHub prerelease"