mirror of
https://github.com/Homebrew/brew.git
synced 2026-10-28 09:34:42 +08:00
Merge pull request #24309 from Homebrew/casks_audit_reject_rosetta
cask/audit: reject new casks requiring Rosetta
This commit is contained in:
3 files changed
+45
-5
No files matched your search
@@ -806,10 +806,8 @@ module Cask
|
||||
def audit_rosetta
|
||||
return if (url = cask.url).nil?
|
||||
return unless online?
|
||||
# Rosetta 2 is only for ARM-capable macOS versions, which are Big Sur (11.x) and later
|
||||
return unless Homebrew::SimulateSystem.simulating_or_running_on_macos?
|
||||
return if Homebrew::SimulateSystem.current_arch != :arm
|
||||
return if MacOSVersion::SYMBOLS.fetch(Homebrew::SimulateSystem.current_os, "10") < "11"
|
||||
return if cask.depends_on.macos&.maximum_version.to_s < "11"
|
||||
|
||||
odebug "Auditing Rosetta 2 requirement"
|
||||
|
||||
@@ -866,7 +864,9 @@ module Cask
|
||||
end
|
||||
|
||||
if any_requires_rosetta
|
||||
if !mentions_rosetta && !requires_intel
|
||||
if new_cask?
|
||||
add_error "New casks must not require Rosetta 2!", location: url.location
|
||||
elsif !mentions_rosetta && !requires_intel
|
||||
add_error "At least one artifact requires Rosetta 2 but this is not indicated by the caveats!",
|
||||
location: url.location
|
||||
end
|
||||
|
||||
@@ -1853,6 +1853,46 @@ RSpec.describe Cask::Audit, :cask do
|
||||
it "recognizes a suppressed requires_rosetta caveat" do
|
||||
expect(run).to pass
|
||||
end
|
||||
|
||||
context "when the cask is new" do
|
||||
let(:new_cask) { true }
|
||||
|
||||
it "rejects artifacts that require Rosetta 2" do
|
||||
expect(run).to error_with("New casks must not require Rosetta 2!")
|
||||
end
|
||||
end
|
||||
|
||||
context "when the cask does not depend on a macOS version" do
|
||||
let(:cask) do
|
||||
Cask::Cask.new("rosetta-audit") do
|
||||
version "1.0"
|
||||
sha256 :no_check
|
||||
url "https://brew.sh/rosetta-audit.zip"
|
||||
name "Rosetta Audit"
|
||||
homepage "https://brew.sh/"
|
||||
|
||||
binary "rosetta-audit"
|
||||
end
|
||||
end
|
||||
|
||||
it "detects artifacts that require Rosetta 2" do
|
||||
expect(run).to error_with(/requires Rosetta 2 but this is not indicated by the caveats/)
|
||||
end
|
||||
end
|
||||
|
||||
context "when auditing for Linux" do
|
||||
let(:new_cask) { true }
|
||||
|
||||
around do |example|
|
||||
Homebrew::SimulateSystem.with(os: :linux, arch: :arm) do
|
||||
example.run
|
||||
end
|
||||
end
|
||||
|
||||
it "skips the audit" do
|
||||
expect(run).to pass
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "artifact case checks" do
|
||||
|
||||
@@ -36,7 +36,7 @@ The [Cask Cookbook](Cask-Cookbook.md#casks-pinned-to-specific-versions) document
|
||||
|
||||
Apple's [Rosetta 2 transition documentation](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment/) says general application support will remain available through macOS 27, with only a narrower legacy-games-focused subset beyond that.
|
||||
Casks that require [`requires_rosetta`](Cask-Cookbook.md#caveats-mini-dsl) remain eligible while the latest major macOS release provides that general support.
|
||||
Under Apple's announced timeline, new `requires_rosetta` casks will become ineligible when macOS 27 is the latest stable macOS version.
|
||||
Under Apple's announced timeline, new `requires_rosetta` casks became ineligible when macOS 27 became the latest stable macOS version and `brew audit --new` rejects them.
|
||||
Existing `requires_rosetta` casks are expected to be deprecated while macOS 27 is current, then disabled or removed after macOS 28 becomes the latest stable macOS version.
|
||||
|
||||
### Regional and localised editions
|
||||
|
||||
Reference in new issue
Block a user