-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
formula_versions: fix tracking previous versions of formulae #20921
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
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.
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 fixes a regression in formula version tracking introduced in commit fa68f3d. The issue occurred when Formula#tap_path (which returns the canonical/theoretical location) was used instead of Formula#path (which returns the actual file location), causing problems with version tracking for non-official sharded taps.
Key Changes:
- Changed
formula.tap_pathtoformula.pathinFormulaVersions#initializeto track the actual formula file location instead of the theoretical one
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
MikeMcQuaid
left a comment
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.
Thanks!
|
Sorry I wasn't able to see this yesterday. This is fine for now, but if |
|
@Rylan12 Maybe a stupid question: why would homebrew/core CI be using the (internal or current) API logic at all when it's got a full GitHub checkout available? |
|
@MikeMcQuaid sorry let me clarify: it's not actually about the API, it's because the The issue is with calculating the bottle rebuild:
Example reproduction instructions, which work regarless of $ brew install --build-bottle hello
==> Fetching downloads for: hello
✔︎ Formula hello (2.12.2)
==> ./configure --disable-silent-rules
==> make install
==> Not running 'post_install' as we're building a bottle
You can run it manually using:
brew postinstall hello
🍺 /opt/homebrew/Cellar/hello/2.12.2: 56 files, 355.0KB, built in 29 seconds
==> Running `brew cleanup hello`...
$ brew bottle --json hello --only-json-tab
==> Determining hello bottle rebuild... /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/h/hello.rb
==> Bottling hello--2.12.2.arm64_tahoe.bottle.1.tar.gz...
./hello--2.12.2.arm64_tahoe.bottle.1.tar.gz
bottle do
rebuild 1
sha256 arm64_tahoe: "45b9d5dbc87e6cf7509c4e5e099ff7889d65c1e1710c2ef57d1e3d9b5896deaf"
end
$ export HOMEBREW_USE_INTERNAL_API=1
$ rm ./hello--2.12.2.arm64_tahoe.bottle.1.tar.gz ./hello--2.12.2.arm64_tahoe.bottle.json
$ brew bottle --json hello --only-json-tab
==> Determining hello bottle rebuild... /opt/homebrew/opt/hello/.brew/hello.rb
==> Bottling hello--2.12.2.arm64_tahoe.bottle.tar.gz...
./hello--2.12.2.arm64_tahoe.bottle.tar.gz
bottle do
sha256 arm64_tahoe: "45b9d5dbc87e6cf7509c4e5e099ff7889d65c1e1710c2ef57d1e3d9b5896deaf"
endNotice that the first time, bottle rebuild was set to 1 (which is correct based on |
|
@Rylan12 Thanks, makes sense. It seems like the |
|
@MikeMcQuaid I believe the This is because From my perspective, it seems that the problem here is really that I don't have time right now to investigate more, unfortunately, but I can try to do so tonight or tomorrow. |
|
@Rylan12 We shouldn't be relying on |
brew stylewith your changes locally?brew typecheckwith your changes locally?brew testswith your changes locally?This broke in fa68f3d (#20895). Since
Formula#tap_pathreturns 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). UsingFormula#pathinstead correctly tracks the actual file location.Fixes #20917.