From 51c8ba46213b41b44d73ac7f2a6bc61e8f50cd09 Mon Sep 17 00:00:00 2001 From: Nick Morozov Date: Wed, 25 Nov 2026 08:42:18 -0700 Subject: [PATCH] Release: render casks without deprecated Homebrew DSL Every brew command that loads the published @beta cask printed two deprecation warnings, and deprecations later turn into errors: - Calling `postflight` is deprecated! Use `postflight_steps` instead. - Calling string comparison format for `depends_on macos:` is deprecated! Use `depends_on macos: :sonoma` instead. render_cask.py now emits `postflight_steps` with `run "/usr/bin/xattr"` and an install-time {{appdir}} token instead of `system_command` with Ruby #{appdir} interpolation. Behavior is the same: the command must succeed, stderr is shown and stdout is hidden. The template uses depends_on macos: :sonoma, which means the same as ">= :sonoma", and its desc is trimmed to 71 characters (brew style's limit is 80), so every rendered variant passes brew style. Tests now check the steps form and that signed builds get no flight stanza at all. Co-Authored-By: Claude Opus 5.5 --- homebrew/Casks/focusrite-volume-control.rb | 4 ++-- scripts/render_cask.py | 12 +++++++----- scripts/test_render_cask.py | 6 ++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/homebrew/Casks/focusrite-volume-control.rb b/homebrew/Casks/focusrite-volume-control.rb index 9fcf9c5..ffec05f 100644 --- a/homebrew/Casks/focusrite-volume-control.rb +++ b/homebrew/Casks/focusrite-volume-control.rb @@ -7,11 +7,11 @@ url "https://github.com/enum-dot-dev/focusrite-volume-control/releases/download/v#{version}/VolumeControl.dmg" name "Volume Control" - desc "Control Focusrite Scarlett 4th gen volume with media keys via Focusrite Control 2" + desc "Control Scarlett 4th gen volume with media keys via Focusrite Control 2" homepage "https://enum.dev/focusrite-volume-control/" conflicts_with cask: "focusrite-volume-control@beta" - depends_on macos: ">= :sonoma" + depends_on macos: :sonoma app "Volume Control.app" diff --git a/scripts/render_cask.py b/scripts/render_cask.py index e556d07..0c2491f 100644 --- a/scripts/render_cask.py +++ b/scripts/render_cask.py @@ -2,8 +2,10 @@ """Render a Homebrew cask for a release from homebrew/Casks/focusrite-volume-control.rb. The release workflow copies the rendered casks into the tap repository, so this repo's -cask stays the single source of truth. Unsigned builds get a postflight that clears -the quarantine attribute, since Gatekeeper blocks un-notarized apps downloaded by brew. +cask stays the single source of truth. Unsigned builds get a postflight_steps stanza that +clears the quarantine attribute, since Gatekeeper blocks un-notarized apps downloaded by +brew. Homebrew deprecated Ruby flight blocks (`postflight do ... system_command ...`), so +the stanza uses the declarative steps DSL with an install-time {{appdir}} token. --beta renders focusrite-volume-control@beta instead. Both casks install the same app, so each one conflicts with the other. Only the beta cask accepts prerelease versions @@ -25,9 +27,9 @@ QUARANTINE_POSTFLIGHT = ''' # Unsigned build: clear quarantine so Gatekeeper doesn't block the app - postflight do - system_command "/usr/bin/xattr", - args: ["-cr", "#{appdir}/Volume Control.app"] + postflight_steps do + run "/usr/bin/xattr", + args: ["-cr", "{{appdir}}/Volume Control.app"] end ''' diff --git a/scripts/test_render_cask.py b/scripts/test_render_cask.py index afaaa2f..fe410a3 100644 --- a/scripts/test_render_cask.py +++ b/scripts/test_render_cask.py @@ -25,6 +25,7 @@ def test_stable(self): self.assertIn(f' sha256 "{SHA}"', cask) self.assertIn(f' conflicts_with cask: "{BETA_TOKEN}"', cask) self.assertNotIn("postflight do", cask) + self.assertNotIn("postflight_steps", cask) self.assertNotIn("auto_updates", cask) def test_beta_swaps_token_and_conflict(self): @@ -53,6 +54,11 @@ def test_unsigned_adds_quarantine_postflight_after_app(self): cask = render(template(), "1.6.0", SHA, unsigned=True, auto_updates=False) self.assertIn(' app "Volume Control.app"\n\n # Unsigned build', cask) self.assertIn('"/usr/bin/xattr"', cask) + # Homebrew deprecated Ruby flight blocks; the steps DSL takes {{...}} tokens, not #{...} + self.assertIn(" postflight_steps do\n", cask) + self.assertNotIn("postflight do", cask) + self.assertNotIn("system_command", cask) + self.assertIn('"{{appdir}}/Volume Control.app"', cask) def test_auto_updates_goes_before_conflicts_with(self): for beta in (False, True):