Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cask/audit: filter bad artifacts in rosetta audit #17575

Merged
merged 2 commits into from
Jun 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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) }

Check warning on line 573 in Library/Homebrew/cask/audit.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/audit.rb#L573

Added line #L573 was not covered by tests

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
Rylan12 marked this conversation as resolved.
Show resolved Hide resolved

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")

Check warning on line 584 in Library/Homebrew/cask/audit.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/audit.rb#L584

Added line #L584 was not covered by tests
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