Skip to content
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

Sync cargo-the-cli version with rustc. #10178

Merged
merged 3 commits into from Dec 13, 2021
Merged

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Dec 7, 2021

People occasionally get confused when cargo's version does not match the version of rustc. This happens in a variety of scenarios:

  • Point releases.
  • Beta releases (cargo is missing the .1 .2, etc.)
  • Nightly releases when cargo's version has not yet been bumped.

This changes it so that cargo-the-cli will always report the same version as rustc (assuming they were built with rustbuild). The git information remains the same (reports cargo's last commit sha).

Closes #10122

This field is no longer being used, as pre-release versions have
not been used in cargo for quite some time, and I don't anticipate
them ever returning.
@rust-highfive
Copy link

r? @alexcrichton

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 7, 2021
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Just wonder is there any documentation for env like CFG_RELEASE? I can find them in rustc source code but not in docs 😞.

@ehuss
Copy link
Contributor Author

ehuss commented Dec 7, 2021

Those CFG_ environment variables are just ad-hoc names used in rustbuild (set here). I don't think they are documented anywhere, as they are low-level internal things of the build system.

Copy link
Contributor

@Eh2406 Eh2406 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will make things less confusing for our users. So I'm giving it an approval.
I'm a little worried that this will make it harder to diagnose issues if somehow the rustc release process has a bug and includes the wrong version of cargo.
So I will leave it up to @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+

Indeed looks good to me!

@bors
Copy link
Collaborator

bors commented Dec 13, 2021

📌 Commit a58725a has been approved by alexcrichton

@bors bors 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 Dec 13, 2021
@bors
Copy link
Collaborator

bors commented Dec 13, 2021

⌛ Testing commit a58725a with merge fe69af3...

@bors
Copy link
Collaborator

bors commented Dec 13, 2021

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing fe69af3 to master...

@bors bors merged commit fe69af3 into rust-lang:master Dec 13, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 15, 2021
Update cargo

14 commits in 40dc281755137ee804bc9b3b08e782773b726e44..a359ce16073401f28b84840da85b268aa3d37c88
2021-12-06 21:54:44 +0000 to 2021-12-14 18:40:22 +0000
- Support `term.quiet` configuration (rust-lang/cargo#10152)
- Display alias target on 'cargo help <alias>` (rust-lang/cargo#10193)
- delete --host command and message (rust-lang/cargo#10145)
- Improve I/O error message for fingerprint of build script (rust-lang/cargo#10191)
- Explicitly mark aliases in `cargo list`. (rust-lang/cargo#10177)
- Don't emit "executable" JSON field for non-executables. (rust-lang/cargo#10171)
- Move scrape-examples docs to correct section. (rust-lang/cargo#10166)
- Do not suggest source config if nothing to vendor (rust-lang/cargo#10161)
- Bump versions of local deps. (rust-lang/cargo#10155)
- Bump to 0.60.0, update changelog (rust-lang/cargo#10154)
- Fix some profile documentation. (rust-lang/cargo#10153)
- Document lib before bin. (rust-lang/cargo#10172)
- Sync cargo-the-cli version with rustc. (rust-lang/cargo#10178)
- Remove `-Z future-incompat-report` from message displayed to user (rust-lang/cargo#10185)
bors added a commit that referenced this pull request Jan 25, 2022
Use local git info for version.

#10178 caused an unintended change where cargo is being built twice in rust-lang/rust's CI.  It is being built once as a CLI, and a second time for RLS.  The cause is the `CFG_COMMIT_HASH` environment variable changes between those two builds (it is set for the tool being built).

The solution here is to grab the git information from cargo's own build script. This is guaranteed to always be in the `src/tools/cargo` directory for both tools.

This should help save a minute or two in the dist builders.
@ehuss ehuss added this to the 1.59.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: 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.

cargo --version is not same as rustc --version for rust-1.56.1
6 participants