You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using rustup installed components as part of an embedded operating system's build system; the people using this may be developing Rust modules or may not even notice that they're pulling in Rust dependencies (well we're not there right now, but it might happen). The builds can have a wide range of targets (I currently have 8 targets installed), and work on different toolchains (some nightly, some stable).
Currently, I'm asserting that everything relevant is installed, and relying on error messages to guide the user -- but apart from current issues these will always be geared toward the Rust user, and not towards RIOT users.
Thus, I'd like to check whether the currently selected combination of toolchain and target is present -- LBYL makes sense over EAFTP here because I'd have to modify the way "forgiving" is asked.
Solution you'd like
Some command of rustup (it might also be cargo, really -- rustup is just my first guess) should have a way to specify a combination of toolchain and targets, and have a return code that can be processed.
This might take the shape of an --offline flag to rustup {toolchain,target} add (making it succeed only if there is nothing to do), extra arguments to cargo check (which has the upside of telling the user that things are there but they might still want to update, but the downside that for use in CI I'd still want an --offline flag so things don't fail if Rust servers are briefly off), or an extra target argument rustup +${TOOLCHAIN} show --target ${TARGET} (which would limit the output to whatever is selected, and would need to start returning an unsuccessful exit code if the selected toolchain or target is not present).
Notes
An alternative that is being considered is "just do it", which would run rustup toolchain add ${TOOLCHAIN} / rustup target add --toolchain ${TOOLCHAIN} ${TARGET} before every build. Being good citizens in the users' home directory this is not a desirable behavior: we'd use space on the user's system without them having authorized it and without a way to garbage-collect it later. (Things might be different if there were a way to add a toolchain / target "weakly" so that it'd be around for the time being and removed by rustup if not used for some time -- but unless that's planned for other reasons, it'd be excessive here).
The text was updated successfully, but these errors were encountered:
I did miss rustup component list; with --toolchain and --installed it is machine processable enough that grepping would give me sane results. (I looked at rustup show to look for installed targets, and that's not really machine readable).
Thanks, I think that's a good enough answer to alleviate the need for further tooling.
Problem you are trying to solve
I'm using rustup installed components as part of an embedded operating system's build system; the people using this may be developing Rust modules or may not even notice that they're pulling in Rust dependencies (well we're not there right now, but it might happen). The builds can have a wide range of targets (I currently have 8 targets installed), and work on different toolchains (some nightly, some stable).
Currently, I'm asserting that everything relevant is installed, and relying on error messages to guide the user -- but apart from current issues these will always be geared toward the Rust user, and not towards RIOT users.
Thus, I'd like to check whether the currently selected combination of toolchain and target is present -- LBYL makes sense over EAFTP here because I'd have to modify the way "forgiving" is asked.
Solution you'd like
Some command of rustup (it might also be cargo, really -- rustup is just my first guess) should have a way to specify a combination of toolchain and targets, and have a return code that can be processed.
This might take the shape of an
--offline
flag torustup {toolchain,target} add
(making it succeed only if there is nothing to do), extra arguments tocargo check
(which has the upside of telling the user that things are there but they might still want to update, but the downside that for use in CI I'd still want an--offline
flag so things don't fail if Rust servers are briefly off), or an extra target argumentrustup +${TOOLCHAIN} show --target ${TARGET}
(which would limit the output to whatever is selected, and would need to start returning an unsuccessful exit code if the selected toolchain or target is not present).Notes
An alternative that is being considered is "just do it", which would run
rustup toolchain add ${TOOLCHAIN}
/rustup target add --toolchain ${TOOLCHAIN} ${TARGET}
before every build. Being good citizens in the users' home directory this is not a desirable behavior: we'd use space on the user's system without them having authorized it and without a way to garbage-collect it later. (Things might be different if there were a way to add a toolchain / target "weakly" so that it'd be around for the time being and removed by rustup if not used for some time -- but unless that's planned for other reasons, it'd be excessive here).The text was updated successfully, but these errors were encountered: