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

x.py: allow a custom string appended to the version #79115

Merged
merged 1 commit into from
Nov 21, 2020

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Nov 16, 2020

This adds rust.description to the config as a descriptive string to be
appended to rustc --version output, which is also used in places like
debuginfo DW_AT_producer. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, gcc --version outputs:

gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to rustc --version.

This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(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 Nov 16, 2020
@jyn514 jyn514 added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Nov 17, 2020
@Mark-Simulacrum
Copy link
Member

I would like to briefly run this by @rust-lang/release in case there's any concerns, but otherwise this seems good to me from an implementation perspective.

@Mark-Simulacrum Mark-Simulacrum added T-release Relevant to the release subteam, which will review and decide on the PR/issue. I-nominated and removed T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Nov 19, 2020
@tmandry
Copy link
Member

tmandry commented Nov 19, 2020

I support this! It will be really useful for toolchain vendors to identify if an issue is coming from their build and whether a binary/bugreport is coming from their toolchain or not.

@pietroalbini
Copy link
Member

While I'd love to see something like this added to the compiler, there are two questions I have:

  • What's the impact of this changes for crates and tools that parse the rustc version?
  • Do we want the field to just be freeform text, or do we want to have structured data (vendor-name, vendor-version...)?

@cuviper
Copy link
Member Author

cuviper commented Nov 19, 2020

What's the impact of this changes for crates and tools that parse the rustc version?

There's already a difference in whether git info is present, e.g. rustup's rustc 1.48.0 (7eac88abb 2020-11-16) vs. distro rustc 1.48.0 alone. I want to add a description like "Fedora 1.48.0-1.fc33", so --version will be rustc 1.48.0 (Fedora 1.48.0-1.fc33).

Tools that parse should use --version --verbose, and this description will have no effect on those verbose fields.

Do we want the field to just be freeform text, or do we want to have structured data (vendor-name, vendor-version...)?

IMO we should let it be freeform, and don't offer any expectation of parsing meaning from this. If we wanted to add verbose fields for structured vendor specifics, that's possible, but ISTR it has been a problem for version-parsing crates to change/add fields.

@Mark-Simulacrum
Copy link
Member

@bors r+

I figure we can iterate if needed.

@bors
Copy link
Contributor

bors commented Nov 20, 2020

📌 Commit 5f08568 has been approved by Mark-Simulacrum

@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 Nov 20, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 21, 2020
…mulacrum

x.py: allow a custom string appended to the version

This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
@bors
Copy link
Contributor

bors commented Nov 21, 2020

⌛ Testing commit 5f08568 with merge b5d6b6e202853e4b132cb605bafae8fede3dc911...

@bors
Copy link
Contributor

bors commented Nov 21, 2020

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 21, 2020
@pietroalbini
Copy link
Member

@bors retry

@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 Nov 21, 2020
@bors
Copy link
Contributor

bors commented Nov 21, 2020

⌛ Testing commit 5f08568 with merge d806d65...

@bors
Copy link
Contributor

bors commented Nov 21, 2020

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing d806d65 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 21, 2020
@bors bors merged commit d806d65 into rust-lang:master Nov 21, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 21, 2020
cuviper added a commit to cuviper/version_check that referenced this pull request Mar 8, 2021
The plain `rustc --version` string is not well structured, and in
particular the git commit info is not necessarily present when rustc was
built out of tree, like distro builds. Furthermore, rust-lang/rust#79115
made it possible to have completely custom information in that version's
parenthesized block, which may not look like git info at all.

Adding `--verbose` outputs each field on its own line, in particular
"release: ..." for the version number and "commit-date: ..." for the git
info, although the latter is just "unknown" for out-of-tree builds. This
still works all the way back to Rust 1.0.0.
cuviper added a commit to cuviper/version_check that referenced this pull request Mar 8, 2021
The plain `rustc --version` string is not well structured, and in
particular the git commit info is not necessarily present when rustc was
built out of tree, like distro builds. Furthermore, rust-lang/rust#79115
made it possible to have completely custom information in that version's
parenthesized block, which may not look like git info at all.

Adding `--verbose` outputs each field on its own line, in particular
"release: ..." for the version number and "commit-date: ..." for the git
info, although the latter is just "unknown" for out-of-tree builds. This
still works all the way back to Rust 1.0.0.
cuviper added a commit to cuviper/version_check that referenced this pull request Mar 8, 2021
The plain `rustc --version` string is not well structured, and in
particular the git commit info is not necessarily present when rustc was
built out of tree, like distro builds. Furthermore, rust-lang/rust#79115
made it possible to have completely custom information in that version's
parenthesized block, which may not look like git info at all.

Adding `--verbose` outputs each field on its own line, in particular
"release: ..." for the version number and "commit-date: ..." for the git
info, although the latter is just "unknown" for out-of-tree builds. This
still works all the way back to Rust 1.0.0.
cuviper added a commit to cuviper/version_check that referenced this pull request Mar 8, 2021
The plain `rustc --version` string is not well structured, and in
particular the git commit info is not necessarily present when rustc was
built out of tree, like distro builds. Furthermore, rust-lang/rust#79115
made it possible to have completely custom information in that version's
parenthesized block, which may not look like git info at all.

Adding `--verbose` outputs each field on its own line, in particular
"release: ..." for the version number and "commit-date: ..." for the git
info, although the latter is just "unknown" for out-of-tree builds. This
still works all the way back to Rust 1.0.0.
SergioBenitez pushed a commit to SergioBenitez/version_check that referenced this pull request Mar 16, 2021
The plain `rustc --version` string is not well structured, and in
particular the git commit info is not necessarily present when rustc is
built out of tree, such as in distro builds. Furthermore,
rust-lang/rust#79115 made it possible to have completely custom
information in a version's parenthesized block, which may not look like
git info at all.

Adding `--verbose` outputs each field on its own line, in particular
"release: ..." for the version number and "commit-date: ..." for the git
info, although the latter is just "unknown" for out-of-tree builds.

MSRV remains 1.0.0.
@cuviper cuviper deleted the rust-description branch September 21, 2021 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-release Relevant to the release subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants