Skip to content

autoremove: handle runtime dependencies#21574

Draft
wu21-web wants to merge 15 commits intoHomebrew:mainfrom
wu21-web:main
Draft

autoremove: handle runtime dependencies#21574
wu21-web wants to merge 15 commits intoHomebrew:mainfrom
wu21-web:main

Conversation

@wu21-web
Copy link

@wu21-web wu21-web commented Feb 14, 2026

Fixes #21511

  • 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?
  • Have you written new 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.
    Yes. Github Copilot was used in some debugging and styling modifications. I came up with the fix. I referenced sobert docs to verify the changes applied.

I noticed that the previous solution of modifying cleanup.rb in /Library/Homebrew/cmd and /Library/Homebrew/ is over-complicated and incorrect. Modifying autoremove.rb in libutils would be much easier.

Added handling for runtime dependencies in autoremove.
Ensures build dependencies are only kept for formulae built from source, not for bottles
Added mock for `runtime_dependencies` to avoid InstanceDouble errors in tests.
Get rid of test failure in CI workers.
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Looks good so far! Please keep this in the same PR and don't open new PRs, instead just squash your history if things get messy.

wu21-web and others added 2 commits February 14, 2026 22:08
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
@MikeMcQuaid MikeMcQuaid changed the title Resolve Issue #21511 by adding handling for runtime dependencies in autoremove Handling runtime dependencies in autoremove Feb 14, 2026
@MikeMcQuaid MikeMcQuaid changed the title Handling runtime dependencies in autoremove Hande runtime dependencies in autoremove Feb 14, 2026
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
@MikeMcQuaid MikeMcQuaid changed the title Hande runtime dependencies in autoremove autoremove: handle runtime dependencies Feb 14, 2026
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
@MikeMcQuaid
Copy link
Member

@wu21-web please ensure you:

  • review all AI generated code locally before you push
  • please don't have you and/or the AI add more obvious comments

@wu21-web
Copy link
Author

OK. Thanks for the tip.

@wu21-web
Copy link
Author

@MikeMcQuaid Hi! Job 63646434598 is failing because Homebrew already has formulae installed when the workflow runs. We have to modify the test.yml to include with.uninstall = true to remove pre installed brew formulas.

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.

brew cleanup says libthai can be removed, but at the same time it is needed by pango

2 participants