-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Support download strategies for livecheck urls #11490
Comments
If the answer is "please raise a PR" then that's fine by me. |
I think @samford is working on extensions to |
If the goal is to allow for requests that involve authentication, this should be possible after 1) livecheck is migrated to With my current approach to options, you'll be able to pass options to That said, I'm not sure how you would approach this in a way that would keep secrets safe without the Just as an aside, I'm also planning to create a PR in the future to add |
It may also be worth mentioning that you can add a If you would benefit from having a strategy that makes sense within the context of your tap (e.g., you have a number of formulae with For what it's worth, I left this feature undocumented (outside of a vague comment in the code) as there has been some pushback in the past about even allowing this in the first place (#7937 (comment)). In my view, past experience has demonstrated its value, even if it's not something that we're going to invest much time/effort in supporting (i.e., we won't significantly modify livecheck to support something weird in a tap if it doesn't also apply to our first-party taps). |
For the use-cases I've seen so far yes, being able to pass
Agreed, for more general use we'd probably want to integrate with the macOS keychain (previous discussion in #11091 (comment)), although the
That would be awesome, the JSON parsing in my original comment in this issue is from a real formula I added. It isn't that much work to do (at least for JSON), but I was surprised to see so many brittle-looking regexes in the core formula that were parsing JSON when we have proper JSON libraries available. |
Oh wow, yeah this would make things a lot easier. Does it work for casks too? Last time I tried to do something similar (library in a tap) it required some complexity for casks because they copy the cask formula file into the caskroom so that you can
Definitely agree with the value of having this per-tap not per-formula. Making it so that private taps can provide standard download methods without having to copy-paste things into every formula (or fork brew) is really helpful. Is there any chance something similar is enabled for DownloadStrategies (for |
Tried this out, and realised it doesn't work if you directly run |
Being able to properly parse JSON requires a That said, I plan to update related
I don't have much familiarity with casks, so all I can say is that if you put a cask file with a
"Something similar" as in defining your own download strategies in a third-party tap? If that's what you mean, I don't think so. The livecheck setup works because the strategy files are kept in a It may be technically possible if we made changes to
The directory you're in must not be in As such, if you want to use tap strategies, your tap will need to exist in When your tap is tapped in Homebrew, you can also use the fully qualified name including the preceding tap name, like |
Makes sense.
It certainly works, and I've used it a bunch, so I hope so 😁
Good point, although hopefully it's the same few lines as in the livecheck, so not too much implementation work.
The reason I do this is that I have a tap update script that runs The symlink is easy enough to do though, so will probably just add that to the script, thanks for the pointer! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I'm still interested in this. |
This issue covers a lot of ground, so I'll summarize the outstanding requested
Based on the above discussion, I believe the original issue description was primarily a request to be able to make authenticated requests with @gibfahn Have I missed (or misinterpreted) anything or does this cover it? |
Thanks for the summary @samford . I agree that passing options to curl solves the issue in the majority of cases, so definitely waiting for you to get time to raise a PR for those changes (no huge rush on my end, currently have a workaround) is reasonable. The case that I'm thinking of that probably wouldn't fit this pattern is when you need to run a function to get an auth token, e.g. you want to run the equivalent of Certainly if you're not working on the latter, help wanted seems reasonable, and I will attempt to get time to get to this when I can. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Passing on this for now, will review a PR. |
Fair, but I thought @samford was currently working on a PR (but that there were other pieces that we needed first). Happy to close the issue anyway. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Provide a detailed description of the proposed feature
There are currently a wide variety of download strategies (that can be extended by users in taps) for downloading resources, but there isn't a way to do the same for livecheck URLs.
Download strategies: https://github.com/Homebrew/brew/blob/master/Library/Homebrew/download_strategy.rb
I'm imagining that one would be able to do:
in the same way you can currently set the strategy in the main block.
This might be somewhat confusing given that there is already a livecheck strategy, but the difference between a livecheck strategy and a download strategy has to be understood anyway by homebrew authors, so hopefully that woulldn't be too painful.
What is the motivation for the feature?
This would allow authenticating to sites that required auth to fetch the latest version.
How will the feature be relevant to at least 90% of Homebrew users?
It would only be relevant for those using custom taps where auth is required, say for example you needed to parse a JSON file to get the latest version:
What alternatives to the feature have been considered?
I'm not aware of an alternative, other than just not using the livecheck feature at all, which is a pity as it works very well.
The text was updated successfully, but these errors were encountered: