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

Respect rust-lang/rust's omit-git-hash #12968

Merged
merged 1 commit into from
Nov 19, 2023

Conversation

pietroalbini
Copy link
Member

The config.toml file in rust-lang/rust has the omit-git-hash option, which prevents git information from being embedded into binaries. This works for most tools, as they rely on the git information provided by bootstrap through environment variables.

Cargo does its own git detection in its build script though, which didn't adhere to to that option. This changes that by skipping git detection whenever bootstrap signals the option is enabled.

@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2023

r? @weihanglo

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

@rustbot rustbot added A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2023
@pietroalbini
Copy link
Member Author

Opened rust-lang/rust#117868 to set that environment variable in the first place. There is no dependency between the two PRs, they can be landed in any order. They will just do nothing until both of them are merged in rust-lang/rust.

The config.toml file in rust-lang/rust has the omit-git-hash option,
which prevents git information from being embedded into binaries. This
works for most tools, as they rely on the git information provided by
bootstrap through environment variables.

Cargo does its own git detection in its build script though, which
didn't adhere to to that option. This changes that by skipping git
detection whenever bootstrap signals the option is enabled.
@pietroalbini
Copy link
Member Author

CI failure seems spurious?

@epage
Copy link
Contributor

epage commented Nov 13, 2023

CI failure should be addressed by #12966

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 good to me, though it's still better if rust-lang/rust#117868 is guaranteed to merge.

compiler-errors added a commit to compiler-errors/rust that referenced this pull request Nov 18, 2023
…-Simulacrum

Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled

This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`.

I created this PR because of rust-lang/cargo#12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2023
…imulacrum

Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled

This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`.

I created this PR because of rust-lang/cargo#12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
@weihanglo
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Nov 19, 2023

📌 Commit ab76a0b has been approved by weihanglo

It is now in the queue for this repository.

@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 19, 2023
@bors
Copy link
Collaborator

bors commented Nov 19, 2023

⌛ Testing commit ab76a0b with merge d794e1f...

@bors
Copy link
Collaborator

bors commented Nov 19, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing d794e1f to master...

@bors bors merged commit d794e1f into rust-lang:master Nov 19, 2023
19 of 20 checks passed
@pietroalbini pietroalbini deleted the pa-omit-git-hash branch November 20, 2023 09:09
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2023
Update cargo

9 commits in 9765a449d9b7341c2b49b88da41c2268ea599720..71cd3a926f0cf41eeaf9f2a7f2194b2aff85b0f6
2023-11-17 20:58:23 +0000 to 2023-11-20 15:30:57 +0000
- Handle $message_type in JSON diagnostics (rust-lang/cargo#13016)
- refactor(toml): Further clean up inheritance (rust-lang/cargo#13000)
- Fix `--check-cfg` invocations with zero features (rust-lang/cargo#13011)
- chore: bump `cargo-credential-*` crates as e58b84d broke stuff (rust-lang/cargo#13010)
- contrib docs: Update now that credential crates are published. (rust-lang/cargo#13006)
- Add more resources to the contrib docs. (rust-lang/cargo#13008)
- Respect `rust-lang/rust`'s `omit-git-hash` (rust-lang/cargo#12968)
- Fix clippy-wrapper test race condition. (rust-lang/cargo#12999)
- fix(resolver): Don't do git fetches when updating workspace members (rust-lang/cargo#12975)
bors added a commit to rust-lang/miri that referenced this pull request Nov 21, 2023
Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled

This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`.

I created this PR because of rust-lang/cargo#12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
@ehuss ehuss added this to the 1.76.0 milestone Dec 6, 2023
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled

This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`.

I created this PR because of rust-lang/cargo#12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled

This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`.

I created this PR because of rust-lang/cargo#12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. 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.

6 participants