-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Write git-commit-{sha,info}
for Cargo in source tarballs
#124553
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will allow Cargo's build script to pick it up, and populate the correct git information in its version output.
r? @onur-ozkan rustbot has assigned @onur-ozkan. Use |
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
labels
Apr 30, 2024
onur-ozkan
approved these changes
Apr 30, 2024
@bors r+ |
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
Apr 30, 2024
bors
added a commit
to rust-lang/cargo
that referenced
this pull request
Apr 30, 2024
Populate git information when building Cargo from Rust's source tarball ### What does this PR try to resolve? Right now Cargo doesn't populate the commit hash or date in its version output when it's built from Rust's plain source tarball (like `rustc-1.77.2-src.tar.xz`). That's because Cargo's build script only looks for information in the `.git` directory, which is missing from that tarball. I opened rust-lang/rust#124553 to have bootstrap inject a `git-commit-info` file in `src/tools/cargo` when building the plain source tarball, containing the correct git information. This is the approach also used by the compiler. This PR updates the build script to read the information from that file if there is no `.git` and the file is present. ### How should we test and review this PR? To test the PR you need to move the `.git` directory somewhere else and create a `git-commit-info` file like this: ``` 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04 25ef9e3d8 2024-04-09 ``` Then clearing the build cache and running `cargo run -- -vV` should show the git information in the `git-commit-info` file. ### Additional information This PR can be merged independently from rust-lang/rust#124553
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 30, 2024
Rollup of 4 pull requests Successful merges: - rust-lang#124280 (Port repr128-dwarf run-make test to rmake) - rust-lang#124299 (Add test for issue 106269) - rust-lang#124553 (Write `git-commit-{sha,info}` for Cargo in source tarballs) - rust-lang#124561 (Add `normalize()` in run-make `Diff` type) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 30, 2024
Rollup merge of rust-lang#124553 - ferrocene:pa-cargo-git-info, r=onur-ozkan Write `git-commit-{sha,info}` for Cargo in source tarballs Right now Cargo doesn't populate the commit hash or date in its version output when it's built from the plain source tarball. That's because we don't include the git information for it, and Cargo's build script doesn't pick it up. This PR *partially* solves the problem by storing the git information for Cargo in `src/tools/cargo` in the plain source tarball. We store separate information because even when built in CI Cargo uses its own git information rather than Rust's. This PR will also require a change in the Cargo repository to consume this information (rust-lang/cargo#13832), but it doesn't have to be blocked on the Cargo PR being merged.
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.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now Cargo doesn't populate the commit hash or date in its version output when it's built from the plain source tarball. That's because we don't include the git information for it, and Cargo's build script doesn't pick it up.
This PR partially solves the problem by storing the git information for Cargo in
src/tools/cargo
in the plain source tarball. We store separate information because even when built in CI Cargo uses its own git information rather than Rust's.This PR will also require a change in the Cargo repository to consume this information (rust-lang/cargo#13832), but it doesn't have to be blocked on the Cargo PR being merged.