Skip to content

Add scoped install step warnings (11/24) - #23188

Merged
MikeMcQuaid merged 3 commits into
install-step-10-process-terminationfrom
install-step-11-warnings
Jul 26, 2026
Merged

Add scoped install step warnings (11/24)#23188
MikeMcQuaid merged 3 commits into
install-step-10-process-terminationfrom
install-step-11-warnings

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member

Some formula hooks only warn when a persistent path needs user attention
and do not need arbitrary post-install code.

  • add a literal warning step shared with cask flight phases
  • compose warnings with path guards instead of embedded conditions
  • expand fixed context tokens in warning messages

AI disclosure: using OpenAI Codex 5.6 Sol max with local review and
testing.

@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-10-process-termination branch from db69d73 to da90b84 Compare July 20, 2026 07:22
@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-11-warnings branch from 5b8758d to 259d082 Compare July 20, 2026 07:22
@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-10-process-termination branch from da90b84 to 300810b Compare July 21, 2026 07:14
@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-11-warnings branch from 259d082 to 7514b48 Compare July 21, 2026 07:14
@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-10-process-termination branch 3 times, most recently from 7068271 to bd0c9d3 Compare July 26, 2026 12:24
@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-11-warnings branch from 7514b48 to d112c5e Compare July 26, 2026 12:24
@MikeMcQuaid
MikeMcQuaid marked this pull request as ready for review July 26, 2026 13:05
@MikeMcQuaid
MikeMcQuaid requested a review from Copilot July 26, 2026 13:05

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

Adds a first-class warn install-step to Homebrew’s InstallSteps DSL, enabling scoped warnings (via path guards like if_path_exists) without requiring arbitrary Ruby in post_install hooks. This supports incremental conversion of formula/cask hooks into declarative install steps while keeping warning messages token-expandable at runtime.

Changes:

  • Add warn to Homebrew::InstallSteps::DSL and execute it in the runner via opoo with template-token expansion.
  • Update RuboCop install-steps allowlist/specs to recognise warn as a valid step.
  • Add a runner spec validating that warn executes when an if_path_exists guard matches.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Library/Homebrew/install_steps.rb Introduces warn step in the DSL and runner execution.
Library/Homebrew/rubocops/shared/install_steps_helper.rb Extends allowed step method list to include warn (formula allowlist only).
Library/Homebrew/test/install_steps_spec.rb Adds spec covering warn under a matching path scope.
Library/Homebrew/test/rubocops/install_steps_spec.rb Updates RuboCop spec expectations to include warn in the allowed methods list.
docs/Formula-Cookbook.md Updates cookbook command/lifecycle section to reference warning-related steps (currently mismatched with implementation).
Comments suppressed due to low confidence (2)

Library/Homebrew/rubocops/shared/install_steps_helper.rb:31

  • warn is added to ALLOWED_STEP_METHODS but not to CASK_ALLOWED_STEP_METHODS, so the cask install-steps cop will still flag warn as an invalid step in cask flight-phase *_steps blocks (and its error message won’t mention it). Add *NOTICE_STEP_METHODS to the cask allowlist to keep formula and cask step DSL parity.
      CASK_ALLOWED_STEP_METHODS = T.let(
        [*FILE_PREPARATION_STEP_METHODS, *CONFIG_WRITE_STEP_METHODS, *KEYCHAIN_STEP_METHODS,
         *PERMISSION_STEP_METHODS, *COMMAND_STEP_METHODS, *STEP_SCOPE_METHODS].freeze,
        T::Array[Symbol],
      )

docs/Formula-Cookbook.md:1111

  • This sentence documents warn_if_exists, which doesn’t exist. Consider describing warn and mention that it can be wrapped in if_path_exists/unless_path_exists guards to make it conditional on paths.
`terminate_process` terminates a process by name or, with `matching: :full`, by its full command line. It supports retries, `notices:` shown before the first attempt and a `failure_message:` warning. `warn_if_exists` emits a warning when any listed path exists.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/Formula-Cookbook.md Outdated
@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-10-process-termination branch from bd0c9d3 to 2c2089f Compare July 26, 2026 13:24
Some formula hooks only warn when a persistent path needs user attention
and do not need arbitrary post-install code.

- add a literal warning step shared with cask flight phases
- compose warnings with path guards instead of embedded conditions
- expand fixed context tokens in warning messages
@MikeMcQuaid
MikeMcQuaid force-pushed the install-step-11-warnings branch from d112c5e to 46b43d5 Compare July 26, 2026 13:24
Eight GCC formulae share the same Linux runtime-link and specs
generation algorithm after installation.

- probe the active GCC and glibc runtime locations
- generate family-appropriate library, linker and header search paths
- keep the repeated algorithm behind one literal formula step
@MikeMcQuaid
MikeMcQuaid merged commit 7e571b7 into install-step-10-process-termination Jul 26, 2026
6 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the install-step-11-warnings branch July 26, 2026 15:44
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