-
Notifications
You must be signed in to change notification settings - Fork 133
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 support for downloading with aria2 if it's already installed #111
Conversation
Nice. It'd be nice to make |
@thii That’s a good idea, I hadn’t thought of that! I’m leaning towards making it optional in the formula, at least to begin with, so that this is an incremental change. (Part of my hesitation is that installing aria2 took hours despite providing a bottle, because it had to build a bunch of its dependencies. I think this might have been because of the versions of some formulas that I already had installed, and so not everyone will have this experience, but I’d like to see how it works for more people first.) |
If we do want to make aria2 the default download option in the future I'd like to look into statically linking libaria2 instead of relying on the separate executable. I don't know if this would actually work yet, though 😄 Edit: Oh, right, except it's GPLv2, so xcodes would need to be the same if we linked the library. |
I just noticed the installation slowness too. Let's keep it optional for now. |
The previous URL still works, but I was having issues with it when using aria2 for downloads. This new URL matches whats shown in a browser at developer.apple.com/download/more, and works with both URLSession and aria2.
8e3be05
to
4baa2f4
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.
A few questions about the Aria2 code but otherwise looks good
I tried adding |
By default, xcodes will use a URLSession to download the specified version. If aria2 (available in Homebrew with
brew install aria2
) is installed, either at /usr/local/bin/aria2c or at the path specified by the --aria2 flag, then it will be used instead. aria2 will use up to 16 connections to download Xcode 3-5x faster (based on a couple tests on my residential internet). If you have aria2 installed and would prefer to not use it, you can use the --no-aria2 flag.aria2 downloads should retry up to 3 times if it fails in the middle, just like URLSession. Errors that cause aria2c to exit with a non-zero status code will show an appropriate error message.
In order to support both aria2 and URLSession, I had to change the download URLs. The previous URL prefix still works, but I was having issues with it when using aria2 for downloads. This new URL prefix matches whats shown in a browser at developer.apple.com/download/more, and works with both URLSession and aria2.
Closes #93
Testing
Download a bunch of xcodes while you're on this branch 😄
First, clone this repo if necessary and check out the PR branch:
You can test this new behaviour with your own account using a command like:
You should try installing both with and without aria2, so:
You can see if aria2c is being used during install by opening Activity Monitor and filtering for
aria2c
in the top right.