Open XAMPPRocky opened 3 years ago
Does using the RUSTUP_DIST_SERVER
environment variable address your use case? I think something like RUSTUP_DIST_SERVER=https://rust.example.com/ rustup install custom-channel
should work.
Well I think it might technically fit, though I don't think I'm familiar enough with rustup's internals to say whether it completely would. For example how does that rustup update
without RUSTUP_DIST_SERVER
being set? But I think terms of usability, I'd like something a lot more user friendly, as environment variables aren't really as cross platform as having it in a config file. Ideally you would be able to use this toolchain just like any other channel.
We've wanted to support alternative dist servers for a while now, so this is definitely something we'd like to explore. There may be issues I can link to this, but I don't have them to hand right now.
I have a rough sketch idea of how this might work, but it'll need fleshing out and exploring so if someone wanted to work on this, we should probably start with a zoom/gmeet/whatever to discuss the approach idea I have.
I would like to try to work on this
We should make a plan to have a realtime discussion about what this might entail then, so that you can work on a design document. This is quite a big task and I'd rather not run at it half-cocked. What timezone are you in @chansuke ?
@kinnison Thank you for your comment. I'm in JST.
JST is UTC+9. Will your clocks change next week? If so then you stay 9 hours ahead of me, if not, then you'll become only 8h ahead. Either way I'm guessing that unless you're a night owl, the best way for us to have a chat would be in my morning, your evening. I shall see what I can find in terms of available time either tomorrow or Friday, or else early next week, and then propose a set of options for you.
@kinnison Do you know what the current state of this issue is? I would like to have rustup for downloading a toolchain instead of my library pulling things from third-party servers. If needed I can also contribute to this. However, I would have expected this to be a comparably small change, while you indicated that this might be a larger task. So if you want we can set up an online meeting to figure things out. I'm in CEST, so it should be comparably easy.
@ZuseZ4 I'm afraid I've not seen any further work on this from anyone. If you're interested in helping us to work out the right way to do this and then implementing it then that'd be cool. It is unlikely to be a particularly small change because there'll be a lot of Rustup which needs checking to ensure that assumptions hold properly. For example, currently dist toolchains (i.e. ones which can contain components, have a manifest file to lay them out, etc.) are always fetched from the RUSUP_DIST_ROOT
/RUSTUP_DIST_SERVER
so there'll need to be a mechanism to ensure we know which toolchains are related to which dist servers at minimum, along with adjusting all the plumbing to be able to cope with all of that. Then there're expected behaviours such as "setting the RUSTUP_DIST_*
env-vars before rustup $command
is expected to override the server for that toolchain (or all toolchains if not otherwise specified) but only for the duration of that command.
And then there's the question of how to parse toolchain names and decide what they are. Currently numbered toolchains, stable
beta*
and nightly*
are considered to be distribution toolchains, whereas anything else is a custom toolchain. We'd likely end up needing some kind of registry of servers and the toolchain name patterns which are to be considered dist for that server, at which point the current static regular expressions for parsing toolchains will need adjusting to understand those other dist servers.
This really isn't a small job. I think a good first start would be to define what the UX would be like for this feature, i.e. what you want your users to be running, how would it interact with them and with the servers and $RUSTUP_HOME
. Once we have a goal UX we can think about what it'd take internally to get toward that point.
@kinnison First of all thanks for the explanation. Sorry for the late answer. I had to get some other PRs done before and didn't noticed how the time passed.
My job: Integrating Enzyme into Rust. Enzyme is an auto-diff tool and requires llvm-bc and debug-infos from the source code. It creates a library based on the new llvm-bc which should be linked against the compiled source code at certain, marked positions.
My fallback solution / earlier plan
Letting user run cargo install enzyme
and building enzyme/llvm/clang/rustc locally.
Providing an executable cargo-enzyme
which acts as a cargo wrapper and does the background steps mentioned above.
My UX goal
Users do something like rustup toolchain install --custom-remote https://enzyme.mit.edu/releases enzyme
once.
This downloads rustc/clang/libLLVM/Enzyme + whatever is needed from the server.
A few weeks later they call rustup update
which looks for a newer enzyme stack and possibly replaces the older one.
To run their code they use cargo +enzyme run --release
If people run cargo run --release
without the Enzyme toolchain we just take the library created during an earlier run and link it.
If we can't find a library we give a useful error message.
Generally: People don't install enzyme anymore, don't waste hours compiling and only use it as a normal cargo.toml dependency to mark sections on which enzyme should work.
This is possibly over-simplified, so let me know if I dropped details which are relevant to you.
I'm also not 100% convinced that we can get there completely.
How close is my user story to your expectations @kinnison ?
Does using the RUSTUP_DIST_SERVER environment variable address your use case? I think something like RUSTUP_DIST_SERVER=https://rust.example.com/ rustup install custom-channel should work.
@ehuss Could you, or anyone else point me to any docs/repos/examples on how https://static.rust-lang.org/
is hosted; specifically the structure and manifest files so that we can try and achieve what you're suggesting above?
Describe the problem you are trying to solve It would be nice to be able to specify custom toolchains at a remote location, so that you can very easily download and install custom toolchain using Rustup. So that other distributors can just provide URLs to their distribution, and not require users to manually download and link the toolchain themselves. Of course this remote location would have to follow the same conventions as Rust's CI, but that's not really an issue since most users of this feature would distributing using
x.py
anyway, just to their servers.Describe the solution you'd like
Unresolved Questions
link
is also another command for creating a custom toolchain but is filesystem only right now. Should thelink
command be used instead ofinstall
?