-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove nanosecond modification times from Cargo fingerprints
- Loading branch information
1 parent
af2f7f6
commit 876a49e
Showing
5 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
|
||
# The docker filesystem layers (at least AUFS) preserve | ||
# nanosecond-level granularity while the container is running, but | ||
# lose that granularity when the image is saved. | ||
# | ||
# This causes spurious rebuilds of any crate that uses file | ||
# modification-based timestamps, as the time appears to have | ||
# changed. See https://github.com/rust-lang/cargo/issues/2874 for some | ||
# further details. | ||
# | ||
# As a terrible, nasty hack, let's just rewrite the fingerprint files | ||
# to set the nanosecond value to 0, matching the filesystem. This | ||
# relies on the unstable internals of the JSON cache files, so this is | ||
# likely quite brittle. | ||
|
||
t=$(mktemp) | ||
jq 'if .local.variant == "MtimeBased" then .local.fields[0][1] |= 0 else . end' "$1" > "$t" | ||
mv "$t" "$1" |
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 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 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