-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Fix brew info --json
regressions around install status
#14609
Conversation
Review period skipped due to |
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.
Are we sure that the API is necessary when printing the info for formulae? The original issue (#14541) only referenced problems related to cask info generation. It could have been broken before that though or there may have been another issue I missed as well.
Also, it'd be really nice if there was a small regression test that we could add so this sort of thing doesn't happen again.
# TODO: can we implement these in Formulary? | ||
if self.class.loaded_from_api && Homebrew::EnvConfig.install_from_api? | ||
json_formula = Homebrew::API::Formula.all_formulae[name] | ||
json_formula = Homebrew::API.merge_variations(json_formula) | ||
hsh["oldname"] = json_formula["oldname"] | ||
hsh["requirements"] = json_formula["requirements"] | ||
end |
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.
Were these things missing even before the most recent regression?
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.
Yes. I hand tested by comparing with and without HOMEBREW_NO_INSTALL_FROM_API
. See qt@5
as an example.
We do not currently read requirements or oldname from the JSON file. This will be fixed after 4.0.0 - I don't think people would be happy if I tried to get something larger before 4.0.0. 😅
Variations also don't work without the original source, hence why that has the hybrid of API + local.
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.
Nice work again @Bo98!
#14587 unfortunately introduced some notable regressions to
brew info --json
:outdated
boolean (very popularly used in scripts)."token"
was missing from casks and"name"
was missing from formulae.This PR fixes this by:
Formula#to_hash
to instead take from the local state (our Formulary work means this works fine), except foroldname
andrequirements
. In a future 4.0.x release, this will likely go away in favour of reading that data on the Formulary side. I'll make a PR after 4.0.0 with that - I'm keeping this PR as low risk as possible by only touching the broken functions.Formula#to_hash_with_variation
to take both the local hash and API hash and take the relevant bits from both.Fixes #14600.