@@ -20,7 +20,7 @@ pub(crate) fn prepare() {
20
20
"https://github.com/rust-random/rand.git" ,
21
21
"0f933f9c7176e53b2a3c7952ded484e1783f0bf1" ,
22
22
) ;
23
- apply_patches ( "crate_patches" , " rand", Path :: new ( "rand" ) ) ;
23
+ apply_patches ( "rand" , Path :: new ( "rand" ) ) ;
24
24
25
25
clone_repo (
26
26
"regex" ,
@@ -73,19 +73,14 @@ fn prepare_sysroot() {
73
73
. current_dir ( & sysroot_src) ;
74
74
spawn_and_wait ( git_commit_cmd) ;
75
75
76
- apply_patches ( "patches" , " sysroot", & sysroot_src) ;
76
+ apply_patches ( "sysroot" , & sysroot_src) ;
77
77
78
78
clone_repo (
79
79
"build_sysroot/compiler-builtins" ,
80
80
"https://github.com/rust-lang/compiler-builtins.git" ,
81
81
"0.1.45" ,
82
82
) ;
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" ) ) ;
89
84
}
90
85
91
86
fn clone_repo ( target_dir : & str , repo : & str , rev : & str ) {
@@ -102,8 +97,8 @@ fn clone_repo(target_dir: &str, repo: &str, rev: &str) {
102
97
spawn_and_wait ( checkout_cmd) ;
103
98
}
104
99
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" )
107
102
. unwrap ( )
108
103
. map ( |entry| entry. unwrap ( ) . path ( ) )
109
104
. filter ( |path| path. extension ( ) == Some ( OsStr :: new ( "patch" ) ) )
@@ -116,10 +111,10 @@ fn get_patches(patch_dir: &str, crate_name: &str) -> Vec<OsString> {
116
111
patches
117
112
}
118
113
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) {
121
116
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 ( ) ;
123
118
let mut apply_patch_cmd = Command :: new ( "git" ) ;
124
119
apply_patch_cmd. arg ( "am" ) . arg ( patch_arg) . arg ( "-q" ) . current_dir ( target_dir) ;
125
120
spawn_and_wait ( apply_patch_cmd) ;
0 commit comments