Rollup merge of #46421 - mnd:fix-build-for-guix, r=alexcrichton
build_helper: destination file can't be up to date when not exists Function "up_to_date" return incorrect result if mtime for all fetched sources is set to epoch time. Add existence check to function. This fix required for a [Guix](https://www.gnu.org/software/guix/) package because a Nix builder set mtime of all sources to epoch time.
This commit is contained in:
commit
5617477502
@ -190,6 +190,9 @@ pub fn mtime(path: &Path) -> FileTime {
|
|||||||
///
|
///
|
||||||
/// Uses last-modified time checks to verify this.
|
/// Uses last-modified time checks to verify this.
|
||||||
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
|
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
|
||||||
|
if !dst.exists() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
let threshold = mtime(dst);
|
let threshold = mtime(dst);
|
||||||
let meta = match fs::metadata(src) {
|
let meta = match fs::metadata(src) {
|
||||||
Ok(meta) => meta,
|
Ok(meta) => meta,
|
||||||
|
Loading…
Reference in New Issue
Block a user