about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-28 14:20:47 -0400
committerOneirical <manchot@videotron.ca>2024-08-01 10:56:48 -0400
commitb485dd14956ea5d744be38cc5201b8a983be7582 (patch)
treeb044d3ff4fa01528f813619204a668d26b40dc31 /src
parentc0e32983f5b06a6f7d8cc776ccac71de6512ed6d (diff)
downloadrust-b485dd14956ea5d744be38cc5201b8a983be7582.tar.gz
rust-b485dd14956ea5d744be38cc5201b8a983be7582.zip
rewrite reproducible-build-2 to rmake
Diffstat (limited to 'src')
-rw-r--r--src/tools/run-make-support/src/fs.rs22
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
2 files changed, 22 insertions, 1 deletions
diff --git a/src/tools/run-make-support/src/fs.rs b/src/tools/run-make-support/src/fs.rs
index 0a796161633..b896168b0a5 100644
--- a/src/tools/run-make-support/src/fs.rs
+++ b/src/tools/run-make-support/src/fs.rs
@@ -83,6 +83,28 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) {
     ));
 }
 
+#[track_caller]
+/// An extension of [`std::fs::copy`] which can copy a directory recursively.
+pub fn copy_dir_all<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) {
+    create_dir_all(&to);
+    for entry in read_dir(from) {
+        let entry = entry.unwrap();
+        let ty = entry.file_type().unwrap();
+        if ty.is_dir() {
+            copy_dir_all(entry.path(), to.as_ref().join(entry.file_name()));
+        } else if ty.is_symlink() {
+            copy_symlink(entry.path(), to.as_ref().join(entry.file_name()));
+        } else {
+            copy(entry.path(), to.as_ref().join(entry.file_name()));
+        }
+    }
+}
+
+fn copy_symlink<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) {
+    let target_path = fs::read_link(from).unwrap();
+    std::os::unix::fs::symlink(target_path, to).unwrap();
+}
+
 /// A wrapper around [`std::fs::File::create`] which includes the file path in the panic message.
 #[track_caller]
 pub fn create_file<P: AsRef<Path>>(path: P) {
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 8747a6265c6..13230239796 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -41,7 +41,6 @@ run-make/raw-dylib-alt-calling-convention/Makefile
 run-make/raw-dylib-c/Makefile
 run-make/redundant-libs/Makefile
 run-make/remap-path-prefix-dwarf/Makefile
-run-make/reproducible-build-2/Makefile
 run-make/reproducible-build/Makefile
 run-make/rlib-format-packed-bundled-libs/Makefile
 run-make/simd-ffi/Makefile