Skip to content

x.py: Give a more helpful error message if curl isn't installed - #71819

Merged
bors merged 1 commit into
rust-lang:masterfrom
jyn514:check-for-tools
May 6, 2020
Merged

x.py: Give a more helpful error message if curl isn't installed#71819
bors merged 1 commit into
rust-lang:masterfrom
jyn514:check-for-tools

Conversation

@jyn514

Copy link
Copy Markdown
Member

Before:

Updating only changed submodules
Submodules updated in 0.01 seconds
Traceback (most recent call last):
File "./x.py", line 11, in <module>
bootstrap.main()
...
File "/home/joshua/src/rust/src/bootstrap/bootstrap.py", line 137, in run
ret = subprocess.Popen(args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

After:

Updating only changed submodules
Submodules updated in 0.01 seconds
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
failed to run: curl -s -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpSWF21P.sha256 https://static.rust-lang.org/dist/2020-04-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz.sha256: [Errno 2] No such file or directory
Build completed unsuccessfully in 0:00:00

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @Mark-Simulacrum

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 3, 2020
@jyn514

Copy link
Copy Markdown
MemberAuthor

I'm not sure that the RuntimeError is the right way to go about things since other parts of the program seem to assume that means a spurious failure ... I'm not sure how else to give a reasonable message though. Maybe it would be better to just print the error and exit unconditionally?

@Mark-Simulacrum

Copy link
Copy Markdown
Member

Hm, we can probably do the same thing we do for git? IIRC we run git --version and if that fails assume git isn't installed or won't do what we need.

@jyn514

Copy link
Copy Markdown
MemberAuthor

Ooh that looks like a good way to do it! I see that sort of thing is repeated a lot (also for uname, isainfo) - do you mind if I factor it out into a function at the same time?

@Mark-Simulacrum

Copy link
Copy Markdown
Member

Not at all, please do!

@jyn514

Copy link
Copy Markdown
MemberAuthor

The new output is

Updating only changed submodules
Submodules updated in 0.01 seconds
error: `curl` is not found, please make sure it's installed and in the path.

@jyn514

jyn514 commented May 3, 2020

Copy link
Copy Markdown
MemberAuthor

I realized that this will now give a misleading error if you have the command in path but the command failed (e.g. maybe -s isn't a valid argument to uname). I'm going to print out the entire command that failed instead so it's easier to debug.

@jyn514

Copy link
Copy Markdown
MemberAuthor

New output:

Updating only changed submodules
Submodules updated in 0.01 seconds
error: `curl --version` is not found, please make sure it's installed and in the path.

@Mark-Simulacrum

Copy link
Copy Markdown
Member

Hm, can we perhaps say:

``
Unable to run curl --version: OSError: not found
Please make sure it's installed and in PATH.

@jyn514

Copy link
Copy Markdown
MemberAuthor

How does this look?

error: unable to run `curl --version`: [Errno 2] No such file or directory
Please make sure it's installed and in the path.

@Mark-Simulacrum

Copy link
Copy Markdown
Member

Please squash the commits into one; r=me after that.

This also abstracts checking for a command into `require`.
Before:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
Traceback (most recent call last):
File "./x.py", line 11, in <module>
bootstrap.main()
...
File "/home/joshua/src/rust/src/bootstrap/bootstrap.py", line 137, in run
ret = subprocess.Popen(args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
```
After:
```
error: unable to run `curl --version`: [Errno 2] No such file or directory
Please make sure it's installed and in the path.
```
@Mark-Simulacrum

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented May 5, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 9bcf409 has been approved by Mark-Simulacrum

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 5, 2020
…lacrum
x.py: Give a more helpful error message if curl isn't installed
Before:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
Traceback (most recent call last):
File "./x.py", line 11, in <module>
bootstrap.main()
...
File "/home/joshua/src/rust/src/bootstrap/bootstrap.py", line 137, in run
ret = subprocess.Popen(args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
```
After:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
failed to run: curl -s -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpSWF21P.sha256 https://static.rust-lang.org/dist/2020-04-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz.sha256: [Errno 2] No such file or directory
Build completed unsuccessfully in 0:00:00
```
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 5, 2020
…lacrum
x.py: Give a more helpful error message if curl isn't installed
Before:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
Traceback (most recent call last):
File "./x.py", line 11, in <module>
bootstrap.main()
...
File "/home/joshua/src/rust/src/bootstrap/bootstrap.py", line 137, in run
ret = subprocess.Popen(args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
```
After:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
failed to run: curl -s -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpSWF21P.sha256 https://static.rust-lang.org/dist/2020-04-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz.sha256: [Errno 2] No such file or directory
Build completed unsuccessfully in 0:00:00
```
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 5, 2020
…lacrum
x.py: Give a more helpful error message if curl isn't installed
Before:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
Traceback (most recent call last):
File "./x.py", line 11, in <module>
bootstrap.main()
...
File "/home/joshua/src/rust/src/bootstrap/bootstrap.py", line 137, in run
ret = subprocess.Popen(args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
```
After:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
failed to run: curl -s -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpSWF21P.sha256 https://static.rust-lang.org/dist/2020-04-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz.sha256: [Errno 2] No such file or directory
Build completed unsuccessfully in 0:00:00
```
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 5, 2020
…lacrum
x.py: Give a more helpful error message if curl isn't installed
Before:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
Traceback (most recent call last):
File "./x.py", line 11, in <module>
bootstrap.main()
...
File "/home/joshua/src/rust/src/bootstrap/bootstrap.py", line 137, in run
ret = subprocess.Popen(args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
```
After:
```
Updating only changed submodules
Submodules updated in 0.01 seconds
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
spurious failure, trying again
failed to run: curl -s -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpSWF21P.sha256 https://static.rust-lang.org/dist/2020-04-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz.sha256: [Errno 2] No such file or directory
Build completed unsuccessfully in 0:00:00
```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2020
Rollup of 7 pull requests
Successful merges:
- rust-lang#71269 (Define UB in float-to-int casts to saturate)
- rust-lang#71591 (use new interface to create threads on HermitCore)
- rust-lang#71819 (x.py: Give a more helpful error message if curl isn't installed)
- rust-lang#71893 (Use the `impls` module to import pre-existing dataflow analyses)
- rust-lang#71929 (Use -fvisibility=hidden for libunwind)
- rust-lang#71937 (Ignore SGX on a few ui tests)
- rust-lang#71944 (Add comment for `Ord` implementation for array)
Failed merges:
r? @ghost
@bors
bors merged commit 538a353 into rust-lang:masterMay 6, 2020
@jyn514
jyn514 deleted the check-for-tools branch May 6, 2020 20:47
@mibac138mibac138 mentioned this pull request May 7, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jyn514@rust-highfive@Mark-Simulacrum@bors