From 8e570a0e9bc1bef19d6dcaec911dff2d956c99e8 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Thu, 27 Jun 2024 20:36:51 +0200 Subject: [PATCH 1/2] feat: check for unknown arch for casks --- Library/Homebrew/cask/audit.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index f0ed98b2da9d9..4b8bd523e18a3 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -590,6 +590,14 @@ def audit_rosetta next end + 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 + end + supports_arm = result.merged_output.include?("arm64") mentions_rosetta = cask.caveats.include?("requires Rosetta 2") From 203049b2f5decc0c5cf4df54d7459468d1002e1f Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Fri, 28 Jun 2024 09:28:55 +0200 Subject: [PATCH 2/2] fix: improve audit for binary stanza --- Library/Homebrew/cask/audit.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 4b8bd523e18a3..0d73a538aedc1 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -580,15 +580,14 @@ def audit_rosetta 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 - 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 add_error "Unknown artifact type: #{artifact.class}", location: cask.url.location end - unless result.success? - add_error "Failed to determine artifact architecture!", location: cask.url.location - next - end + # binary stanza can contain shell scripts, so we just continue if lipo fails. + next unless result.success? odebug result.merged_output