-
Notifications
You must be signed in to change notification settings - Fork 892
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 NO_OP mode to rustup-init.sh #3830
base: master
Are you sure you want to change the base?
Conversation
When calling this script, it immediately starts the download process. This change is mostly useful for when we want to source this file from another script file. Signed-off-by: onur-ozkan <[email protected]>
What are you actually trying to achieve? I'm not inclined to add complexity to this script in order to support niche use cases like this. You can just copy the source code of the rustup-init.sh. |
fwiw initially I tried adding "--no-op/-n" argument, but passing arguments wasn't working well when sourcing the script file. |
We are replacing the python sources from bootstrap with shell scripts in order to remove python dependency on bootstrap. Which means we need to figure out the target triple and download its stage0 artifacts.
The change is quite simple actually. Do you think copying part of this source will be better in terms of maintainability? It seems much complex solution IMO. |
@djc I think the goal is to reuse Rustup's host triple resolution as a shell script module. @onur-ozkan I guess |
Correct.
I can duplicate the script, I thought it would be much better to import the script right away (as the change we are adding here simply quits the process, it should be stable enough) so we don't have to maintain/sync the another copy. But I see your point, I can copy it as a start. |
@onur-ozkan I mean I don't see why we cannot both depend on some same thing in the end. If you have found out the right boundaries to make the split, we can depend on you instead :) PS: This functionality is especially interesting for our downstreams as well. |
@djc @ChrisDenton I've been having second thoughts on this one, since adding an optional "dry run" mode would also be useful for testing target detection on our side (even in cases like #3800). But maybe it should not be implemented like this (I mean the It's true that we don't have guarantees about CLI output stability, but at least we have this |
Can you describe what you would propose exactly (maybe as a PR if that's a straightforward way to implement it)? |
@djc I'd like to propose an alternative execution mode for the How does that sound? |
Alternatively, we could move the useful functions into a separate script that only provides the functions without executing anything. This way we can import and use it from other places without needing to add an extra execution mode to |
This is sounding like the I'd be a bit uncomfortable with a separate script due to the need to keep the two scripts in sync. |
I didn’t mean that. |
Sounds reasonable to me. |
@onur-ozkan Yeah, that's basically what I proposed initially, but after some investigation on my side... It now seems to me that the user's side would very much like to have a self-contained script at least for On the other hand, some rambling: we have one strange requirement that calling the script with Lines 33 to 40 in 708ffd6
My original plan was that we keep the |
As part of one of my tasks I need to resolve the target triple at the shell script level during the initial bootstrap phase (before rustc is available). The functionality is already implemented in the rustup script and I don't want to duplicate it in the upstream rust repository. My plan is to fetch the rustup script from https://sh.rustup.rs using curl and then
source
it from the caller script, so I can access/execute theget_architecture
function. However, this is not possible because it immediately initiates the download process. As a solution to that, I propose this PR (which is a dead-simple change) that allows us to source this file easily (likeNO_OP=1 . ./rustup-init.sh
) without runnig the actual workflow.