-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Add Formula#tap_path and use Formula#latest_formula
#20895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
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 new Formula#tap_path method that returns the expected path within a tap for a formula, regardless of whether the tap is currently installed, and replaces several direct references to self with Formula#latest_formula to explicitly obtain the latest formula version. These changes prepare the codebase for future functionality without altering current behavior.
Key Changes
- Added
Formula#tap_pathmethod that returns the formula's expected path within its tap - Updated
Formula#latest_formulato callFormulary.factory(name)instead of returningself - Enhanced test stubs to include
namemethod onFormulaLoaderinstances
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/formula.rb | Added tap_path method; updated latest_formula to use Formulary.factory(name); updated outdated_kegs to use latest_formula |
| Library/Homebrew/formula_versions.rb | Changed to use tap_path instead of path |
| Library/Homebrew/dev-cmd/bottle.rb | Updated bottle metadata to use tap_path instead of path |
| Library/Homebrew/cmd/reinstall.rb | Updated to use latest_formula when building install context |
| Library/Homebrew/cmd/outdated.rb | Updated to use latest_formula.pkg_version |
| Library/Homebrew/test/support/helper/formula.rb | Added name method stub to FormulaLoader double |
| Library/Homebrew/test/migrator_spec.rb | Added Formulary.factory stubs for formula names |
| Library/Homebrew/test/formula_spec.rb | Added stub_formula_loader calls and cache clearing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
192168d to
de7e904
Compare
|
Maintainers: if this causes something to break, please ping me. I am lightly monitoring for the next several hours, and will try to fix forward if I can |
Hi @Rylan12, Please see the below output where Brew replaces > git -C /home/linuxbrew/.linuxbrew/Homebrew/ checkout de7e904887
HEAD is now at de7e904887 Explicitly use `Formula#latest_formula` where needed
> brew --version
Homebrew 4.6.17-52-gde7e904
> brew uninstall tpm && brew install madh93/tap/tpm && brew upgrade
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/tpm/3.1.0... (43 files, 109KB)
==> Fetching downloads for: tpm
==> Fetching madh93/tap/tpm
==> Downloading https://github.com/Madh93/tpm/releases/download/v0.4.0/tpm_Linux_x86_64.tar.gz
==> Downloading from https://release-assets.githubusercontent.com/github-production-release-asset/6287
############################################################################################### 100.0%
==> Installing tpm from madh93/tap
✔ /home/linuxbrew/.linuxbrew/Cellar/tpm/0.4.0: 6 files, 8.9MB, built in 1 second
==> Running `brew cleanup tpm`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
Removing: /home/georgii/.cache/Homebrew/tpm_bottle_manifest--3.1.0-1... (2.5KB)
Removing: /home/georgii/.cache/Homebrew/tpm--3.1.0... (15.2KB)
==> Upgrading 1 outdated package:
tpm 0.4.0 -> 3.1.0
==> Fetching downloads for: tpm
==> Fetching tpm
==> Downloading https://ghcr.io/v2/homebrew/core/tpm/blobs/sha256:585e25b7dbe7d14caa7056eb0cc5f180256d
############################################################################################### 100.0%
==> Upgrading tpm
0.4.0 -> 3.1.0
==> Pouring tpm--3.1.0.all.bottle.1.tar.gz
==> Caveats
To initialize TPM add this to your tmux configuration file
(~/.tmux.conf or $XDG_CONFIG_HOME/tmux/tmux.conf):
run '/home/linuxbrew/.linuxbrew/opt/tpm/share/tpm/tpm'
==> Summary
✔ /home/linuxbrew/.linuxbrew/Cellar/tpm/3.1.0: 43 files, 109KB
==> Running `brew cleanup tpm`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
Removing: /home/linuxbrew/.linuxbrew/Cellar/tpm/0.4.0... (6 files, 8.9MB)
Removing: /home/georgii/.cache/Homebrew/tpm--0.4.0.tar.gz... (3.6MB)Good commit, where formulae from Tap isn't replaced by one from Core (fa68f3d): > git -C /home/linuxbrew/.linuxbrew/Homebrew/ checkout fa68f3d30f
Previous HEAD position was de7e904887 Explicitly use `Formula#latest_formula` where needed
HEAD is now at fa68f3d30f Add `Formula#tap_path` method for theoretical formula file location in tap
> brew --version
Homebrew 4.6.17-51-gfa68f3d
> brew uninstall tpm && brew install madh93/tap/tpm && brew upgrade
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/tpm/3.1.0... (43 files, 109KB)
==> Fetching downloads for: tpm
==> Fetching madh93/tap/tpm
==> Downloading https://github.com/Madh93/tpm/releases/download/v0.4.0/tpm_Linux_x86_64.tar.gz
==> Downloading from https://release-assets.githubusercontent.com/github-production-release-asset/6287
############################################################################################### 100.0%
==> Installing tpm from madh93/tap
✔ /home/linuxbrew/.linuxbrew/Cellar/tpm/0.4.0: 6 files, 8.9MB, built in 1 second
==> Running `brew cleanup tpm`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
Removing: /home/georgii/.cache/Homebrew/tpm_bottle_manifest--3.1.0-1... (2.5KB)
Removing: /home/georgii/.cache/Homebrew/tpm--3.1.0... (15.2KB)Please let me know if you'd like me to "convert" this to an issue. |
|
Thanks for the ping, @yermulnik, and I appreciate the thorough reproduction instructions! I can indeed reproduce this, and @botantony's PR linked above fixes the issue for me. Once that's fully merged, try running |
|
It works as expected with Brew |
This broke in fa68f3d (#20895). Since `Formula#tap_path` returns the theoretical/canonical location within a tap that a formula will live, it may not correspond to the actual location of the formula file (e.g., when a non-official tap is sharded). Using `Formula#path` instead correctly tracks the actual file location. Fixes #20917.
This PR extracts some of the changes from #20830
These changes include:
Formula#tap_pathwhich outputs the expected path within a tap that a formula will live, regardless of whether the tap is currently installed or not.Formula#latest_formulain several places where we eventually will need the latest formula explicitly.Note, until a later PR, these changes should not affect any behavior.