-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Set timestamp on generated files in archive to now #7523
Conversation
When generating files (Cargo.lock, Cargo.toml, and .cargo_vcs_info.json), cargo neglected to set any timestamp on the file in the archive. This results in them being created on disk with a timestamp of 0 (Jan 1 1970 GMT) which is confusing another tool I use. This patch alters the behavior to set the mtime to now. Signed-off-by: Bruce Guenter <bruce@untroubled.org>
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks! Could this be updated though to avoid duplication and only calculate this once? |
Moving it into a function would be trivial, and I could sweep the other bits that are duplicated there as well. By "calculate this only once" do you mean in a single place, or once per execution with something like |
Signed-off-by: Bruce Guenter <bruce@untroubled.org>
src/cargo/ops/cargo_package.rs
Outdated
@@ -786,3 +767,28 @@ fn check_filename(file: &Path) -> CargoResult<()> { | |||
} | |||
Ok(()) | |||
} | |||
|
|||
lazy_static::lazy_static! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to avoid a lazy_static
here, it's fine if the times differe by a bit I just wanted to avoid the dance to get the seconds out from being repeated 3 times (which using a helper function fixes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lazy_static
is just the last commit. Would you prefer a revert commit or just drop the last commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to force-push the branch to drop the commit
@bors: r+ |
📌 Commit b33c9e2 has been approved by |
Set timestamp on generated files in archive to now When generating files (Cargo.lock, Cargo.toml, and .cargo_vcs_info.json), cargo neglected to set any timestamp on the file in the archive. This results in them being created on disk with a timestamp of 0 (Jan 1 1970 GMT) which is confusing another tool I use. This patch alters the behavior to set the mtime to now. Signed-off-by: Bruce Guenter <bruce@untroubled.org>
☀️ Test successful - checks-azure |
Update cargo 6 commits in 3a9abe3f065554a7fbc59f440df2baba4a6e47ee..3ba5f27170db10af7a92f2b682e049397197b8fa 2019-10-15 15:55:35 +0000 to 2019-10-22 15:05:18 +0000 - Fix typo in `cargo install --profile` help (rust-lang/cargo#7532) - Use stricter -Z flag parsing. (rust-lang/cargo#7531) - Set timestamp on generated files in archive to now (rust-lang/cargo#7523) - Support rustc's `-Z panic-abort-tests` in Cargo (rust-lang/cargo#7460) - rustfmt for nightly changes. (rust-lang/cargo#7526) - Allow --all-features in root of virtual workspace. (rust-lang/cargo#7525)
Update cargo 6 commits in 3a9abe3f065554a7fbc59f440df2baba4a6e47ee..3ba5f27170db10af7a92f2b682e049397197b8fa 2019-10-15 15:55:35 +0000 to 2019-10-22 15:05:18 +0000 - Fix typo in `cargo install --profile` help (rust-lang/cargo#7532) - Use stricter -Z flag parsing. (rust-lang/cargo#7531) - Set timestamp on generated files in archive to now (rust-lang/cargo#7523) - Support rustc's `-Z panic-abort-tests` in Cargo (rust-lang/cargo#7460) - rustfmt for nightly changes. (rust-lang/cargo#7526) - Allow --all-features in root of virtual workspace. (rust-lang/cargo#7525)
When generating files (Cargo.lock, Cargo.toml, and
.cargo_vcs_info.json), cargo neglected to set any timestamp on the file
in the archive. This results in them being created on disk with a
timestamp of 0 (Jan 1 1970 GMT) which is confusing another tool I use.
This patch alters the behavior to set the mtime to now.
Signed-off-by: Bruce Guenter bruce@untroubled.org