Skip to contentSkip to conversation

scripts: rust_is_available.sh: Provide hints on how to fix missing pieces

PATCH In review Olof Johansson 3 participants 6 messages Oct 4, 2022 – Oct 14, 2022 Rust

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: rust_is_available.sh: Provide hints on how to fix missing pieces

This might be a bit bikesheddy, but it saves a few roundtrips to the documentation when getting the make LLVM=1 rustavailable run to pass.

Stick to the rustup options to avoid too much verbosity.

---
 scripts/rust_is_available.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/rust_is_available.sh +9 -0
index aebbf1913970..94e6a1ce1df3 100755
@@ -59,6 +59,9 @@ if [ "$rust_compiler_cversion" -lt "$rust_compiler_min_cversion" ]; then
 		echo >&2 "***   Your version:    $rust_compiler_version"
 		echo >&2 "***   Minimum version: $rust_compiler_min_version"
 		echo >&2 "***"
+		echo >&2 "*** To update to the expected version:"
+		echo >&2 "***   \$ rustup override set \$(scripts/min-tool-version.sh rustc)"
+		echo >&2 "***"
 	fi
 	exit 1
 fi
@@ -68,6 +71,9 @@ if [ "$1" = -v ] && [ "$rust_compiler_cversion" -gt "$rust_compiler_min_cversion
 	echo >&2 "***   Your version:     $rust_compiler_version"
 	echo >&2 "***   Expected version: $rust_compiler_min_version"
 	echo >&2 "***"
+	echo >&2 "*** To update to the expected version:"
+	echo >&2 "***   \$ rustup override set \$(scripts/min-tool-version.sh rustc)"
+	echo >&2 "***"
 fi
 
 # Check that the Rust bindings generator is suitable.
@@ -155,6 +161,9 @@ if [ ! -e "$rustc_src_core" ]; then
 		echo >&2 "*** Source code for the 'core' standard library could not be found"
 		echo >&2 "*** at '$rustc_src_core'."
 		echo >&2 "***"
+		echo >&2 "*** To install sources:"
+		echo >&2 "***   \$ rustup component add rust-src"
+		echo >&2 "***"
 	fi
 	exit 1
 fi
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Olof Johansson

This might be a bit bikesheddy, but it saves a few roundtrips to the documentation when getting the make LLVM=1 rustavailable run to pass.

Yeah, I have bin there :-)

Quoted 7 lines

Stick to the rustup options to avoid too much verbosity.

---
 scripts/rust_is_available.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
#2 lore raw
Quoted 9 lines · Geert Stappers
Quoted 2 lines · Olof Johansson

This might be a bit bikesheddy, but it saves a few roundtrips to the documentation when getting the make LLVM=1 rustavailable run to pass.

Yeah, I have bin there :-)

Quoted 2 lines

Stick to the rustup options to avoid too much verbosity.

Quoted 7 lines
Quoted 5 lines
---
 scripts/rust_is_available.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

How to prevent that the patch gets lost in the mail?

And how to avoid that reminders like this get contra-productive? (When to send the next "Please approve or reject the patch"?)

Groeten
Geert Stappers

Signature · 1 line
Silence is hard to parse
#3 lore raw

Hi Geert,

Quoted 2 lines · Geert Stappers

How to prevent that the patch gets lost in the mail?

Do not worry, it is not lost :)

Quoted 2 lines

And how to avoid that reminders like this get contra-productive? (When to send the next "Please approve or reject the patch"?)

The author of the patch would normally send a ping. If you are curious, please see Documentation/process/submitting-patches.rst for some guidelines.

In short, the authors would wait at least a week, and they would apply their best judgment (e.g. whether the merge window is going on, whether it is a new feature or a critical fix, whether feedback/comments/tags are still coming, etc.).

Cheers,
Miguel

#4 lore raw
In reply to Olof Johansson
Quoted 3 lines · Olof Johansson

This might be a bit bikesheddy, but it saves a few roundtrips to the documentation when getting the make LLVM=1 rustavailable run to pass.

It is faster for someone that already knows how things work, but it may make newcomers skip the docs and it duplicates the information there. In addition, for the non-error case, it makes it more verbose which may not be appreciated. So maybe we should point to the docs instead? What do you think?

Also, the patch doesn't add instructions for all the cases, so somebody that may have hit one of the documented ones + not have read the docs may wonder where to find them the solution or why they are missing.

Thanks!

Cheers,
Miguel

#5 lore raw
Quoted 11 lines · Miguel Ojeda
Quoted 3 lines · Olof Johansson

This might be a bit bikesheddy, but it saves a few roundtrips to the documentation when getting the make LLVM=1 rustavailable run to pass.

It is faster for someone that already knows how things work, but it may make newcomers skip the docs and it duplicates the information there. In addition, for the non-error case, it makes it more verbose which may not be appreciated. So maybe we should point to the docs instead? What do you think?

I don't really have a preference. This patch would have helped me, so I figured I would post it. My interest isn't really high enough to spend more effort on it at this time -- I got my setup working by now.

Refactoring the script to have a shared message on non-successful exit with a reference to the doc would achieve what you're suggesting though.

Quoted 4 lines

Also, the patch doesn't add instructions for all the cases, so somebody that may have hit one of the documented ones + not have read the docs may wonder where to find them the solution or why they are missing.

Sure.

-Olof