aboutsummaryrefslogtreecommitdiff
path: root/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2022-08-25 14:30:04 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2022-08-25 14:49:50 +0000
commitb9b250f91299716bc4a7a6b7b8db2284c57f16ca (patch)
treee0011b148402850bfba2f57b181c15037cb1dc29 /lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
parent0864916dd08431b20381e6d180ce0958e749199d (diff)
downloadports-b9b250f91299716bc4a7a6b7b8db2284c57f16ca.tar.gz
ports-b9b250f91299716bc4a7a6b7b8db2284c57f16ca.zip
Diffstat (limited to 'lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs')
-rw-r--r--lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs31
1 files changed, 23 insertions, 8 deletions
diff --git a/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs b/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
index 081c2056ad2c..03a24563bf05 100644
--- a/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
+++ b/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
@@ -15,14 +15,29 @@ links during the build, so let's try that.
--- src/bootstrap/lib.rs.orig 2020-07-23 20:16:43 UTC
+++ src/bootstrap/lib.rs
-@@ -1173,10 +1173,6 @@ impl Build {
- if metadata.file_type().is_symlink() {
- let link = t!(fs::read_link(src));
- t!(symlink_file(link, dst));
-- } else if let Ok(()) = fs::hard_link(src, dst) {
+@@ -1450,19 +1450,13 @@ impl Build {
+ return;
+ }
+ }
+- if let Ok(()) = fs::hard_link(&src, dst) {
- // Attempt to "easy copy" by creating a hard link
- // (symlinks don't work on windows), but if that fails
- // just fall back to a slow `copy` operation.
- } else {
- if let Err(e) = fs::copy(src, dst) {
- panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
+- } else {
+- 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));
++ 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));
+ }
+
+ /// Copies the `src` directory recursively to `dst`. Both are assumed to exist