@@ -89,6 +89,19 @@ impl GitRepo {
8989 }
9090 }
9191
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+
92105 pub ( crate ) fn fetch ( & self , dirs : & Dirs ) {
93106 let download_dir = self . download_dir ( dirs) ;
94107
@@ -126,18 +139,11 @@ impl GitRepo {
126139 assert ! ( target_lockfile. exists( ) ) ;
127140 }
128141
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) ;
138143 }
139144
140145 pub ( crate ) fn patch ( & self , dirs : & Dirs ) {
146+ self . verify_checksum ( dirs) ;
141147 apply_patches (
142148 dirs,
143149 self . patch_name ,
0 commit comments