Skip to content

Commit

Permalink
Merge pull request #17575 from krehel/update-audit-rosetta
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Jun 30, 2024
2 parents 3df562a + a7b2da0 commit 3948359
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Library/Homebrew/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,19 @@ def audit_rosetta
odebug "Auditing Rosetta 2 requirement"

extract_artifacts do |artifacts, tmpdir|
is_container = artifacts.any? { |a| a.is_a?(Artifact::App) || a.is_a?(Artifact::Pkg) }

artifacts.filter { |a| a.is_a?(Artifact::App) || a.is_a?(Artifact::Binary) }
.each do |artifact|
next if artifact.is_a?(Artifact::Binary) && is_container

path = tmpdir/artifact.source.relative_path_from(cask.staged_path)

result = case artifact
when Artifact::App
files = Dir[path/"Contents/MacOS/*"]
files = Dir[path/"Contents/MacOS/*"].select do |f|
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)
when Artifact::Binary
Expand Down

0 comments on commit 3948359

Please sign in to comment.