Skip to content

Commit d71b125

Browse files
committed
Merge the crate_patches dir into the patches dir
1 parent 066d5f9 commit d71b125

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

build_system/prepare.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) fn prepare() {
2020
"https://github.com/rust-random/rand.git",
2121
"0f933f9c7176e53b2a3c7952ded484e1783f0bf1",
2222
);
23-
apply_patches("crate_patches", "rand", Path::new("rand"));
23+
apply_patches("rand", Path::new("rand"));
2424

2525
clone_repo(
2626
"regex",
@@ -73,19 +73,14 @@ fn prepare_sysroot() {
7373
.current_dir(&sysroot_src);
7474
spawn_and_wait(git_commit_cmd);
7575

76-
apply_patches("patches", "sysroot", &sysroot_src);
76+
apply_patches("sysroot", &sysroot_src);
7777

7878
clone_repo(
7979
"build_sysroot/compiler-builtins",
8080
"https://github.com/rust-lang/compiler-builtins.git",
8181
"0.1.45",
8282
);
83-
84-
apply_patches(
85-
"crate_patches",
86-
"compiler-builtins",
87-
Path::new("build_sysroot/compiler-builtins"),
88-
);
83+
apply_patches("compiler-builtins", Path::new("build_sysroot/compiler-builtins"));
8984
}
9085

9186
fn clone_repo(target_dir: &str, repo: &str, rev: &str) {
@@ -102,8 +97,8 @@ fn clone_repo(target_dir: &str, repo: &str, rev: &str) {
10297
spawn_and_wait(checkout_cmd);
10398
}
10499

105-
fn get_patches(patch_dir: &str, crate_name: &str) -> Vec<OsString> {
106-
let mut patches: Vec<_> = fs::read_dir(patch_dir)
100+
fn get_patches(crate_name: &str) -> Vec<OsString> {
101+
let mut patches: Vec<_> = fs::read_dir("patches")
107102
.unwrap()
108103
.map(|entry| entry.unwrap().path())
109104
.filter(|path| path.extension() == Some(OsStr::new("patch")))
@@ -116,10 +111,10 @@ fn get_patches(patch_dir: &str, crate_name: &str) -> Vec<OsString> {
116111
patches
117112
}
118113

119-
fn apply_patches(patch_dir: &str, crate_name: &str, target_dir: &Path) {
120-
for patch in get_patches(patch_dir, crate_name) {
114+
fn apply_patches(crate_name: &str, target_dir: &Path) {
115+
for patch in get_patches(crate_name) {
121116
eprintln!("[PATCH] {:?} <- {:?}", target_dir.file_name().unwrap(), patch);
122-
let patch_arg = Path::new(patch_dir).join(patch).canonicalize().unwrap();
117+
let patch_arg = Path::new("patches").join(patch).canonicalize().unwrap();
123118
let mut apply_patch_cmd = Command::new("git");
124119
apply_patch_cmd.arg("am").arg(patch_arg).arg("-q").current_dir(target_dir);
125120
spawn_and_wait(apply_patch_cmd);

0 commit comments

Comments
 (0)