-
-
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
Only checksum file downloads, not VCS downloads #13411
Only checksum file downloads, not VCS downloads #13411
Conversation
I don't think VCS downloads are currently supported with casks other than SVN and now the Git sparse checkout strategy that you're adding. Does it make sense to check for an unsupported edge case? |
Oh interesting, TIL! Currently, I don't think there's anything stopping you using another VCS download strategy — the sparse checkout approach doesn't do anything special to pick git, it just uses the fact that it's inferred from the Given it currently is possible, I think it'd be marginally better to handle this case, or to explicitly prevent use of the VCS downloaders for casks if that's the intended behaviour. |
That is definitely interesting because it's not the behavior I would have expected from reading the docs. I wonder if casks are audited for acceptable download strategy before they are submitted or if we just hope they use a supported strategy. It's also possible that the docs are outdated as well.
I agree but I'd like to get other people's opinions on this too. |
Agreed, the svn section of the docs about Cask URLs does give the impression that only HTTP(S) and svn based downloads are supported even though in practice various download strategies seem to work. |
Just following up. There are indeed no checks made when loading casks limiting them to the download strategies mentioned in the docs (which right now are |
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.
Makes sense to me, thanks @hmarr!
@apainintheneck Not sure where you stand on this one; can you elaborate further? |
I think this PR makes sense to me. It means we won't have to update this method every time a new download strategy is added which is good. That being said the example that wasn't working is an undocumented use case. Shouldn't we either document that or add a check somewhere to enforce that? But I can open another issue about that if you want. |
I think fine to leave undocumented and just let people fix undocumented things like they have in this PR 😁 |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?#13358 fixes Homebrew/homebrew-cask-fonts#5855 for SVN casks (and #13354 was the initial approach), but I think the problem still exists for other VCS downloads such as Git. The special case of partial clones with sparse checkouts is handled in #13232 via ccdd45d, but for regular Git downloads I'm able to reproduce the problem.
Example cask
Output
This change uses the logic in the
DownloadStrategyDetector
to determine whether to calculate a checksum or not. It looks like all of the concreteDownloadStrategy
implementation inherit either fromAbstractFileDownloadStrategy
orVCSDownloadStrategy
, so I think checking forAbstractFileDownloadStrategy
in the list of ancestors should be a robust approach. If there's a better way of doing this, I'd be happy to change tack, though!Output with this change
Shout out to @apainintheneck and @bevanjkay for the initial work on fixing this error 🙌