-
-
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
Add warning message to postinstall #14026
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.
Currently, cask flight blocks probably do work as expected since we're loading directly from the source. Once we start loading from the API, we'll probably need to add something here but for now, there's no need.
For formulae, I don't think this is the proper fix. First of all, we only need to show an error message if HOMEBREW_INSTALL_FROM_API
is set and the formula the user is trying to postinstall was installed using the API (i.e. it's a formula from homebrew/core). Also, the fix should go in either FormulaInstaller#post_install
or Formula#run_post_install
since brew postinstall
isn't directly called during the regular formula install step.
Finally, the error should be clearer and specific to HOMEBREW_INSTALL_FROM_API
. I'd recommend something like "When HOMEBREW_INSTALL_FROM_API
is set, the postinstall may be outdated. If you need to run the latest version, install without HOMEBREW_INSTALL_FROM_API
." (although we'll probably need to workshop that because it's a bit wordy)
@Rylan12 Personally: I don't think we need a warning here at all. I'm not convinced |
@MikeMcQuaid I think you're right in most cases. To make this even more sensitive: here's an idea. What if we store the hash of either the postinstall source or the postinstall method object (I assume that's something that can be done) in the JSON API. That way, it would be updated every hour and would always represent the latest postinstall code. When a user runs the postinstall (whether through a regular install or manually), we can compare what's going to be run with the hash from the API. If they don't match, that's an indication that there is a new postinstall block available. Thoughts? |
@Rylan12 Makes sense to me! If we're going to store a hash here, though, we may want to consider also storing the actual |
We could, but that means we're potentially executing code online which is exactly what we're trying to avoid. So if we do that, I think it should not be done automatically |
@Rylan12 I think if we want this to be the default path in the nearish future we need to brainstorm a fix that works here 100% of the time. Perhaps that is requiring a |
I think this is a better option, as long as we believe it can be maintained. A revision bump probably would be easier to write an audit for, since I don't think there are any checks we run to make sure bottles are made, but has the downside of forcing users to upgrade when they may not have to |
Yeh, I think we'll need an audit to enforce it.
Yeh, unsure how to force the bottle requirement but I think it'd be better. We want to avoid doing so many unnecessary |
We could probably set up @BrewTestBot to request changes to PRs that modify the postinstall blocks so that they cannot be merged regularly. And then update the various merge workflows to have @BrewTestBot remove their requested changes. That way new bottles are always made. Unless there are cases where |
@Rylan12 Yeh, that sounds like a good idea 👍🏻 |
@hyuraku I'm going to close this out because it sounds like we'd like to address the issue in a different way. Thanks for the PR, though! I don't have the bandwidth right now to work on this but if you or someone else would like to I'll happily review a PR! I also will update the |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?add
A warning or some sort of message should be shown when installing a formula with a post_install block or a cask with a {pre,post}flight block
for #13794