diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-01-23 17:34:43 -0700 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-01-25 14:31:38 -0700 |
| commit | 82fae2be049f37bc20d2bad6c6c482a7d957f687 (patch) | |
| tree | 3cda509366d543b3c9fe0e1cc59e68ce085951b8 /src/bootstrap | |
| parent | 6bba352cad2117f56353d400f71e96eafa2e6bd7 (diff) | |
| download | rust-82fae2be049f37bc20d2bad6c6c482a7d957f687.tar.gz rust-82fae2be049f37bc20d2bad6c6c482a7d957f687.zip | |
Correctly set filetime for copied LLVM
This also makes compiletest no longer always retest everything.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/lib.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index bddc6362389..37451a74dfa 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -135,7 +135,7 @@ use std::cell::{RefCell, Cell}; use std::collections::{HashSet, HashMap}; use std::env; use std::fs::{self, OpenOptions, File}; -use std::io::{self, Seek, SeekFrom, Write, Read}; +use std::io::{Seek, SeekFrom, Write, Read}; use std::path::{PathBuf, Path}; use std::process::{self, Command}; use std::slice; @@ -1263,9 +1263,15 @@ impl Build { if !src.exists() { panic!("Error: File \"{}\" not found!", src.display()); } - let mut s = t!(fs::File::open(&src)); - let mut d = t!(fs::File::create(&dst)); - io::copy(&mut s, &mut d).expect("failed to copy"); + let metadata = t!(src.symlink_metadata()); + if let Err(e) = fs::copy(&src, &dst) { + panic!("failed to copy `{}` to `{}`: {}", src.display(), + dst.display(), e) + } + t!(fs::set_permissions(&dst, metadata.permissions())); + let atime = FileTime::from_last_access_time(&metadata); + let mtime = FileTime::from_last_modification_time(&metadata); + t!(filetime::set_file_times(&dst, atime, mtime)); } chmod(&dst, perms); } |
