Skip to content

info: show build deps for source installs - #24258

Merged
MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
HaraldNordgren:info-build-deps-no-bottle
Oct 14, 2026
Merged

MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
HaraldNordgren:info-build-deps-no-bottle

Conversation

@HaraldNordgren

@HaraldNordgren HaraldNordgren commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

On macOS 12, which Homebrew no longer builds bottles for, brew info ccache says "Installs from source: yes" but lists only the 6 runtime dependencies. brew install --dry-run ccache then wants to install or upgrade 21 formulae (including gcc, llvm, rust and ruby) and nothing in brew info hints where they come from.

The build dependency line should only be hidden when a bottle will be poured, but kegs.all? { |keg| keg.tab.poured_from_bottle } is vacuously true when nothing is installed, so since b796fdc it has been hidden for every uninstalled formula. The check now only applies to installed kegs and otherwise reuses formula_installs_from_source?, so the build dependency line and "Installs from source: yes" always agree.

To reproduce, run brew info ccache on macOS 12, or brew info on any uninstalled formula without a bottle for your platform.

Before:

$ brew info ccache
==> ccache: stable 4.14.1, HEAD
...
Not installed
...
Installs from source: yes
==> Dependencies
Required (6): blake3, fmt, hiredis, openssl@4, xxhash, zstd

After:

$ brew info ccache
==> ccache: stable 4.14.1, HEAD
...
Not installed
...
Installs from source: yes
==> Dependencies
Build (8): asciidoctor, cmake, cpp-httplib, doctest, pkgconf, span-lite, tl-expected, gcc
Required (6): blake3, fmt, hiredis, openssl@4, xxhash, zstd

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Code (Claude Opus 4.8 and Claude Opus 5.5) traced the cause, wrote the fix with its test and drafted this description. Verified with brew typecheck, brew style on the changed files, brew tests --only=cmd/info (the new spec fails on main and passes with the fix) and the brew info ccache before/after above, captured on macOS 12.


@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 50669e6f-3628-4f6b-b4a0-ea63f2f17c38
📥 Commits

Reviewing files that changed from the base of the PR and between 13c102f and ede89af.

📒 Files selected for processing: 1
  • Library/Homebrew/cmd/info.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 18
  • GitHub Check: docker (x86_64 Ubuntu 26.04)
  • GitHub Check: docker (arm64 Ubuntu 24.04)
  • GitHub Check: docker (arm64 Ubuntu 26.04)
  • GitHub Check: docker (x86_64 Ubuntu 24.04)
  • GitHub Check: tests (generic OS, 1/2)
  • GitHub Check: tests (online, 1/2)
  • GitHub Check: tests (load-only Linux)
  • GitHub Check: tests (macOS, 2/2)
  • GitHub Check: tests (load-only macOS)
  • GitHub Check: tests (macOS, 1/2)
  • GitHub Check: tests (Linux, 1/2)
  • GitHub Check: tests (no Sorbet)
  • GitHub Check: tests (Linux, 2/2)
  • GitHub Check: tests (generic OS, 2/2)
  • GitHub Check: tests (online, 2/2)
  • GitHub Check: syntax
  • GitHub Check: Analyze
  • GitHub Check: docs
🧰 Additional context used
📚 Code guidelines: 1
Generated by CodeRabbit — auto-discovered
📓 Path-based instructions: 1
Implement CLI commands as `Homebrew::Cmd` classes inheriting from `AbstractCommand`; declare help text and argument metadata in `cmd_args`, and put command behavior in `run`.

📄 CodeRabbit inference engine (Generated by CodeRabbit)

Files:

  • Library/Homebrew/cmd/info.rb
📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Formula information reports source installation status only when the formula has no installed version, installs from source, and has no macOS or Linux requirement.
    • Build dependencies are shown when an installed version was built from source or an uninstalled formula installs from source. They’re omitted when neither condition applies.

Formula info now uses source-install eligibility to report source installation and build dependencies. The predicate rejects formulas with macOS or Linux requirements. Dependency reporting also checks whether installed kegs were poured from bottles.

Changes: Formula info reporting

Layer / File(s) Summary
Source-install eligibility
Library/Homebrew/cmd/info.rb
The source-install predicate returns false when a formula has a macOS or Linux requirement. Formula metadata reporting now uses this predicate.
Build dependency reporting
Library/Homebrew/cmd/info.rb, Library/Homebrew/test/cmd/info_spec.rb
Build dependencies are omitted only when no installed keg was built from source and an uninstalled formula does not install from source. A test checks that an uninstalled formula with a build dependency and no bottle displays that dependency.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: mikemcquaid

Merge Risk: ⚪ Minimal · up to ede89

For an uninstalled formula eligible for source installation, brew info now shows its build dependencies. The inspected shadowing case follows the existing reporting contract, and no actionable merge risk remains.

Security architecture risk: ⚪ Minimal · up to ede89

The change corrects dependency information without adding installation actions, privileges, or a new command entrypoint. No material security risk was identified in the changed behavior.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure change is limited to human-readable information for queried formulas and Ruby visibility of the helper. The traced callers do not extend that change into privileged installation or another service.

Trust Boundaries and Controls

  • inferred — Formula selection and evaluation remain in the existing Info path. Sharing the eligibility predicate changes reporting decisions, not caller identity, authorization, or authority over installed software; no changed path to a sensitive action was identified.
Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: showing build dependencies for source installs.
Description check Passed The description directly explains the bug, the fix, reproduction steps, expected output, and verification results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@HaraldNordgren
HaraldNordgren marked this pull request as ready for review October 14, 2026 12:58

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, great idea, one wee chance for related scout-rule cleanup.

Comment thread Library/Homebrew/cmd/info.rb Outdated
- `kegs.all?` is vacuously true with no kegs installed, so `brew info`
  hid build deps even when `brew install` would build from source
- the guard also re-implemented `formula_installs_from_source?`
  inline; call it instead, with the other OS check moved inside, so
  the build deps line and "Installs from source: yes" always agree
@HaraldNordgren
HaraldNordgren force-pushed the info-build-deps-no-bottle branch from 13c102f to ede89af Compare October 14, 2026 13:45

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Much nicer thanks!

@MikeMcQuaid
MikeMcQuaid enabled auto-merge October 14, 2026 13:47
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Oct 14, 2026
Merged via the queue into Homebrew:main with commit c18602a Oct 14, 2026
53 checks passed
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