@@ -89,6 +89,19 @@ impl GitRepo {
89
89
}
90
90
}
91
91
92
+ fn verify_checksum ( & self , dirs : & Dirs ) {
93
+ let download_dir = self . download_dir ( dirs) ;
94
+ let actual_hash = format ! ( "{:016x}" , hash_dir( & download_dir) ) ;
95
+ if actual_hash != self . content_hash {
96
+ eprintln ! (
97
+ "Mismatched content hash for {download_dir}: {actual_hash} != {content_hash}. Please run ./y.sh prepare again." ,
98
+ download_dir = download_dir. display( ) ,
99
+ content_hash = self . content_hash,
100
+ ) ;
101
+ std:: process:: exit ( 1 ) ;
102
+ }
103
+ }
104
+
92
105
pub ( crate ) fn fetch ( & self , dirs : & Dirs ) {
93
106
let download_dir = self . download_dir ( dirs) ;
94
107
@@ -126,18 +139,11 @@ impl GitRepo {
126
139
assert ! ( target_lockfile. exists( ) ) ;
127
140
}
128
141
129
- let actual_hash = format ! ( "{:016x}" , hash_dir( & download_dir) ) ;
130
- if actual_hash != self . content_hash {
131
- eprintln ! (
132
- "Download of {download_dir} failed with mismatched content hash: {actual_hash} != {content_hash}" ,
133
- download_dir = download_dir. display( ) ,
134
- content_hash = self . content_hash,
135
- ) ;
136
- std:: process:: exit ( 1 ) ;
137
- }
142
+ self . verify_checksum ( dirs) ;
138
143
}
139
144
140
145
pub ( crate ) fn patch ( & self , dirs : & Dirs ) {
146
+ self . verify_checksum ( dirs) ;
141
147
apply_patches (
142
148
dirs,
143
149
self . patch_name ,
0 commit comments