Skip to content

chore: remove deprecated homebrew cask postflight hook - #149

Closed
emilstahl wants to merge 1 commit into
urlscan:mainfrom
emilstahl:remove-deprecated-cask-hook
Closed

emilstahl wants to merge 1 commit into
urlscan:mainfrom
emilstahl:remove-deprecated-cask-hook

Conversation

@emilstahl

Copy link
Copy Markdown
Contributor

Problem

GoReleaser's cask template wraps homebrew_casks.hooks.post.install in Homebrew's deprecated postflight Ruby block (goreleaser/goreleaser#6870 — fix PR was closed unmerged). So every release regenerates Casks/urlscan-cli.rb in homebrew-tap with a stanza that now prints on every brew install/upgrade/untap:

Warning: Calling `postflight` is deprecated! Use `postflight_steps` instead.
Please report this issue to the urlscan/homebrew-tap tap.

I've also opened urlscan/homebrew-tap#1 to fix the currently-generated cask directly.

Why delete rather than migrate

The hook strips com.apple.quarantine from the staged urlscan binary. But Homebrew downloads cask payloads with its own curl download strategy, which never applies the quarantine xattr (that's set by LaunchServices-aware apps like browsers, not curl). The staged file the hook operates on can never carry the attribute, so the hook is a no-op — dead code that exists only to emit a deprecated stanza.

If you'd rather keep the belt-and-suspenders strip anyway, the migration-safe variant is custom_block (GoReleaser's hooks can't emit postflight_steps since the wrapper stanza is hardcoded in its template):

homebrew_casks:
  - binaries: [urlscan]
    repository:
      owner: urlscan
      name: homebrew-tap
      token: "{{ .Env.TAP_GITHUB_TOKEN }}"
    custom_block: |
      postflight_steps do
        on_macos do
          run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "urlscan"], chdir: "."
        end
      end

Happy to switch this PR to that form if preferred — deletion is just the simpler end state.

Changes

  • Removed hooks.post.install (and its doc-reference comment) from .goreleaser.yaml. Nothing else.

After this merges, the next goreleaser release regenerates the tap cask without any postflight stanza, and the warning is gone for good.

Homebrew deprecated the legacy postflight Ruby block that GoReleaser
generates around homebrew_casks hooks.post.install, so every brew
install/upgrade/untap of the urlscan-cli cask prints:

  Warning: Calling `postflight` is deprecated! Use `postflight_steps` instead.

The hook itself is a no-op: it strips com.apple.quarantine from the
staged binary, but Homebrew downloads cask payloads with its own curl,
which never applies the quarantine xattr. Dropping it removes the
warning-generating stanza entirely.
emilstahl added a commit to emilstahl/homebrew-tap that referenced this pull request Sep 21, 2026
Homebrew deprecated the legacy postflight Ruby block; brew prints a
deprecation warning on every install/upgrade/untap of this cask.

The block is also a no-op: it strips com.apple.quarantine from the
staged binary, but Homebrew downloads cask payloads with its own curl,
which never applies the quarantine xattr. Dropping it removes the
warning-generating stanza entirely and matches what the next GoReleaser
release will generate once the hook is removed from .goreleaser.yaml
(urlscan/urlscan-cli#149).
@ninoseki

Copy link
Copy Markdown
Collaborator

Thanks but it doesn't work.

$ goreleaser check      
  ⨯ command failed                                   error=yaml: found character that cannot start any token

Also I think it's better to wait GoReleaser v2.19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants