-
Notifications
You must be signed in to change notification settings - Fork 785
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
Feature: more flexible mirror URL by a command #1793
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Mingxiang Xue <[email protected]>
084fafc
to
3306271
Compare
@eregon I've updated the example to a POSIX compatible one. Please have a review. Thanks. |
Thanks, that variant avoids relying on exporting shell functions which seems far more portable. I feel like an env var to set the mirror base URL could be simpler, but one issue is e.g.
CRuby mirror list @hsbt What do you think? |
IMO, just changing the domain is definitely the simplest solution. But so far, Lines 364 to 371 in 57c397d
Just changing the domain may also not work for other ruby variants, like jruby (e.g. one url is |
This looks mostly compatible with the implementation that node-build uses from nodenv/node-build#210 As @uzxmx mentioned different mirror urls, it's the same reason node-build opted to accept 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.
Thank you for your contributions to ruby-build and helping make it more usable in China!
As a late reviewer to this whole extended mirror feature, I would like to voice my concerns about the complexity of the feature (incl. the original PR that already got merged).
First of all, I must admit I do not understand RUBY_BUILD_MIRROR_PACKAGE_URL. The value is the static URL from which a Ruby distribution is to be downloaded, right? But a single Ruby install can attempt to download more archives than just the Ruby version. For example, some installs will also need to fetch openssl from a remote server. Does RUBY_BUILD_MIRROR_PACKAGE_URL affects all the downloads initiated within ruby-build, or just the Ruby-related one? If it doesn't affect all downloads, then I fear that this mirror approach isn't adequate.
Second, I am confused about the internal variable RUBY_BUILD_DEFAULT_MIRROR. Why would we have separate logic for the default mirror and for user-provided mirrors? That feels like a code smell to me. Our mirroring logic should be flexible enough to handle either our own mirror or user-provided mirrors without conditionals.
Lastly, I do dig the new RUBY_BUILD_MIRROR_CMD option because it seems the most flexible one. If that gets merged, I would vote to eliminate RUBY_BUILD_MIRROR_PACKAGE_URL and RUBY_BUILD_DEFAULT_MIRROR.
Co-authored-by: Mislav Marohnić <[email protected]>
@mislav Thanks for the suggestion. It's truly useful. Already adopted. I agree the combination of |
Ah, I just realized that RUBY_BUILD_MIRROR_PACKAGE_URL was supported since Dec 2020. I wasn't aware of that. In the interest of backwards compatibility, it should keep being supported, but perhaps we should strip it from documentation in favor of RUBY_BUILD_MIRROR_CMD and perhaps print a deprecation warning to stderr when someone attempts to use it. |
I just recently (finally) have been getting node-build up to date with ruby build the past few weeks. I recently merged nodenv/node-build#901 which backports the I should be able to replicate that into ruby-build if that's still desired. |
This PR provides a more flexible way to specify the mirror URL by using a shell function than #1457.
For #1457, users need to know the complete mirror URL, and another drawback is users need to change the
RUBY_BUILD_MIRROR_PACKAGE_URL
env every time they install a different version.This PR resolves these two drawbacks. Users can build the final mirror URL by any shell commands.
Thanks to the author of #1032, the idea comes from that thread.