Add formula install steps#22372
Merged
Merged
Conversation
e7e5dfa to
875a2c4
Compare
d6e7c6c to
2b6ce9f
Compare
3776eac to
4c1998c
Compare
2b6ce9f to
38e961d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a declarative post_install_steps DSL for formulae, enabling simple post-install file preparation to be represented as structured data (including JSON API serialization) and executed without evaluating arbitrary Ruby in formulae.
Changes:
- Add
post_install_stepsto the formula DSL, formula hashing/API struct serialization, and API-loaded formula class initialization. - Execute
post_install_stepsinbrew install/brew postinstall, preferring steps over legacypost_installwith a warning on conflicts. - Extend
FormulaAudit/InstallStepsRuboCop cop to detect and autocorrect simplepost_installfile-prep intopost_install_steps, and document the new DSL.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/support/fixtures/formulae/install-steps.rb | Adds a fixture formula exercising the post_install_steps DSL. |
| Library/Homebrew/test/rubocops/install_steps_spec.rb | Adds cop coverage for autocorrecting simple post_install into steps. |
| Library/Homebrew/test/formula_spec.rb | Adds unit tests for step normalization/serialization and conflict detection helpers. |
| Library/Homebrew/test/api/formula_struct_spec.rb | Verifies API struct serialize/deserialize includes post_install_steps. |
| Library/Homebrew/sorbet/rbi/dsl/formula.rbi | Exposes post_install_steps in the Sorbet RBI DSL surface. |
| Library/Homebrew/rubocops/shared/api_annotation_helper.rb | Allows post_install_steps as an API-annotated DSL method. |
| Library/Homebrew/rubocops/install_steps.rb | Enables autocorrection for simple post_install file preparation. |
| Library/Homebrew/json_api_postinstall_preflight_postflight_plan.md | Updates planning checklist to mark formula post_install_steps as done. |
| Library/Homebrew/formulary.rb | Plumbs post_install_steps through API-loaded formula class creation. |
| Library/Homebrew/formula.rb | Adds post_install_steps DSL, hashing, execution, and conflict warning behavior. |
| Library/Homebrew/formula_installer.rb | Runs post_install_steps during install/finish in preference to post_install. |
| Library/Homebrew/cmd/postinstall.rb | Runs post_install_steps when available via brew postinstall. |
| Library/Homebrew/api/formula_struct.rb | Adds post_install_steps to the API struct schema and requires install-steps support. |
| docs/Formula-Cookbook.md | Documents recommended usage and constraints of post_install_steps. |
Files not reviewed (1)
- Library/Homebrew/sorbet/rbi/dsl/formula.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
38e961d to
040073b
Compare
- Expose structured `post_install_steps` in formulae and API data. - Prefer steps over legacy `post_install` with a runtime warning. - Document formula usage and keep conversion audits separate.
040073b to
003b9e2
Compare
p-linnane
approved these changes
May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
post_install_stepsin formulae and API data.post_installwith a runtime warning.brew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex 5.5 xhigh with local review and testing.