Skip to content

Add formula install steps#22372

Merged
p-linnane merged 1 commit into
mainfrom
install-steps-formula
May 24, 2026
Merged

Add formula install steps#22372
p-linnane merged 1 commit into
mainfrom
install-steps-formula

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Expose structured post_install_steps in formulae and API data.
  • Prefer steps over legacy post_install with a runtime warning.
  • Document formula usage and autocorrect simple file preparation.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

OpenAI Codex 5.5 xhigh with local review and testing.


@MikeMcQuaid MikeMcQuaid force-pushed the install-steps-core branch from e7e5dfa to 875a2c4 Compare May 21, 2026 15:30
@MikeMcQuaid MikeMcQuaid force-pushed the install-steps-formula branch from d6e7c6c to 2b6ce9f Compare May 22, 2026 11:12
@MikeMcQuaid MikeMcQuaid force-pushed the install-steps-core branch 2 times, most recently from 3776eac to 4c1998c Compare May 22, 2026 16:26
Base automatically changed from install-steps-core to main May 22, 2026 17:33
Copilot AI review requested due to automatic review settings May 22, 2026 18:04
@MikeMcQuaid MikeMcQuaid force-pushed the install-steps-formula branch from 2b6ce9f to 38e961d Compare May 22, 2026 18:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_steps to the formula DSL, formula hashing/API struct serialization, and API-loaded formula class initialization.
  • Execute post_install_steps in brew install/brew postinstall, preferring steps over legacy post_install with a warning on conflicts.
  • Extend FormulaAudit/InstallSteps RuboCop cop to detect and autocorrect simple post_install file-prep into post_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.

Comment thread Library/Homebrew/formula.rb
Comment thread Library/Homebrew/formula.rb Outdated
Comment thread Library/Homebrew/formula.rb Outdated
@MikeMcQuaid MikeMcQuaid force-pushed the install-steps-formula branch from 38e961d to 040073b Compare May 22, 2026 18:37
- 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.
@MikeMcQuaid MikeMcQuaid force-pushed the install-steps-formula branch from 040073b to 003b9e2 Compare May 23, 2026 07:15
@p-linnane p-linnane added this pull request to the merge queue May 24, 2026
Merged via the queue into main with commit dc67ebf May 24, 2026
36 checks passed
@p-linnane p-linnane deleted the install-steps-formula branch May 24, 2026 15:38
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.

3 participants