-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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 cask install receipts #17554
Add cask install receipts #17554
Conversation
93f8bf2
to
a6e1592
Compare
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.
I think in general the approach looks good. It'd be nice to be able to share logic between the formula and cask tab classes though it's possible that there isn't enough overlap to make that worth it.
There are few use cases for this that I've seen recently and I think they all seem to be covered here.
- Storing the tap that a cask was installed from.
- Useful when loading installed casks and troubleshooting installs.
- Wrong tap when listing installed casks from custom taps using
--json=v2 --installed
#17416
- Storing the cask version.
- Useful when upgrading casks to make sure they don't get accidentally downgraded.
- brew upgrade can actually downgrade casks in some configurations #17427
Do you have an example what the tab of a cask with an uninstall DSL looks like? Idea being we avoid reading the Ruby file entirely when uninstalling, except for flight blocks which the tab should have a boolean or something that indicates those are used. |
Here is the tab for {
"homebrew_version": "4.3.6-71-ge30aea5-dirty",
"loaded_from_api": true,
"installed_as_dependency": false,
"installed_on_request": true,
"time": 1719197835,
"dependencies": {
"macos": {
">=": [
"10.15"
]
}
},
"arch": "arm64",
"source": {
"path": "",
"tap": "homebrew/cask",
"tap_git_head": "f755fc333ebe7647fa3988e360d47a82120db032",
"version": "4.39.88"
},
"installed_on": {
"os": "Macintosh",
"os_version": "macOS 14",
"cpu_family": "arm_firestorm_icestorm",
"xcode": "15.4",
"clt": "15.3.0.0.1.1708646388",
"preferred_perl": "5.34"
},
"artifacts": [
{
"uninstall": [
{
"quit": "com.tinyspeck.slackmacgap"
}
]
},
{
"app": [
"Slack.app"
]
},
{
"zap": [
{
"trash": [
"~/Library/Application Scripts/com.tinyspeck.slackmacgap",
"~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.tinyspeck.slackmacgap.sfl*",
"~/Library/Application Support/Slack",
"~/Library/Caches/com.tinyspeck.slackmacgap*",
"~/Library/Containers/com.tinyspeck.slackmacgap*",
"~/Library/Cookies/com.tinyspeck.slackmacgap.binarycookies",
"~/Library/Group Containers/*.com.tinyspeck.slackmacgap",
"~/Library/Group Containers/*.slack",
"~/Library/HTTPStorages/com.tinyspeck.slackmacgap*",
"~/Library/Logs/Slack",
"~/Library/Preferences/ByHost/com.tinyspeck.slackmacgap.ShipIt.*.plist",
"~/Library/Preferences/com.tinyspeck.slackmacgap*",
"~/Library/Saved Application State/com.tinyspeck.slackmacgap.savedState",
"~/Library/WebKit/com.tinyspeck.slackmacgap"
]
}
]
}
]
}
Right now the format I'm saving the artifacts in is the same that is used in the API, so that should be possible (that's what I anticipated happening). Good note on the boolean to indicate about flight blocks, I'll add that. |
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.
Looking good so far, great work @Rylan12!
In both of these cases: we should store the same for formulae and in the same format for both (to make parsing either easier).
My understanding is also we hope to be able to eventually deprecate these flight blocks so that only the tab is needed for uninstall. |
Yeah, though key word there is "eventually" and no one's working on it yet so still should have something in the meantime to improve the majority of cases while we work on improving the final few cases that use flight blocks. Flight block phasing out will likely require multiple distinct enhancements to the uninstall DSL. |
Agreed: just think it's worth considering with the design that we will hopefully not keep this around indefinitely. |
336fd06
to
a4ea7d8
Compare
I've pushed changes to have casks use the same I also updated the |
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.
Great work so far, thanks @Rylan12!
Apologies for closing @Rylan12, my bad :( |
7b8df98
to
c2d808d
Compare
c2d808d
to
bd9898a
Compare
Ah, I got confused. My bad. |
This is fine. We needed something to to determine whether flight blocks are used on uninstall so this works. We'll use this later to only load the Ruby file when needed on uninstall.
|
53c4dc6
to
46cb7f2
Compare
Good point. I updated this in the latest version. Also, I realized that |
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 @Rylan12! Yeh, the AbstractTab approach is making a lot more sense to me.
I pushed changes adding some more shared items to the generic items list, but I left off |
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.
Looks great, almost here! Just a few tweaks, some DRYing up and a little more test coverage and this is good to 🚢. Nice work @Rylan12!
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.
Looking great @Rylan12! I agree with @apainintheneck's comments and then I think we're good to 🚢 this. Thanks for the patience with all the back and forth; higher threshold than a typical PR here just because we want to avoid writing bad tabs and cleaning them up (as happened with formulae).
Agreed, thanks! |
I've just pushed some more changes because I realized that the runtime dependencies in cask tabs did not include any recursive dependencies, only the dependencies that were directly declared. This should be fixed now (with some shared With that, the "runtime_dependencies": {
"cask": [
{
"full_name": "foo-cask",
"version": "1.2.3",
"declared_directly": true
},
{
"full_name": "bar-cask",
"version": "4.5.6",
"declared_directly": false
}
],
"formula": [
{
"full_name": "foo-formula",
"version": "1.2.3",
"revision": 0,
"pkg_version": "1.2.3",
"declared_directly": true
},
{
"full_name": "bar-formula",
"version": "4.5.6",
"revision": 0,
"pkg_version": "4.5.6",
"declared_directly": false
}
],
"macos": {
">=": [
"10.14"
]
},
"arch": [
{
"type": "arm",
"bits": 64
}
]
}, Should the |
The approach to getting the recursive deps for each cask looks good to me. I'm with you when you say that the arch and macos info maybe shouldn't be included in the runtime dependencies section. We already have |
Looks great, thanks @Rylan12! Let's merge this tomorrow when we're all together in case there's any issues. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?This PR is my first go at adding a cast install receipt (which I've called
Tab
to align for formulae) as per #17013.Here is a sample
INSTALL_RECEIPT.json
that is generated when I runbrew install --cask warp
:It doesn't quite work yet (there are some test failures and some other things still) but I wanted to push this up to start getting feedback on the strategy.