File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,16 @@ impl Archive {
117117 Ok ( ( ) )
118118 }
119119
120+ pub fn create ( & self ) -> Result < ( ) > {
121+ let sh = crate :: sh ( ) ?;
122+ let archive = self . as_ref ( ) ;
123+
124+ let ar = crate :: binutil ( "ar" ) . unwrap ( ) ;
125+ cmd ! ( sh, "{ar} qc {archive}" ) . run ( ) ?;
126+
127+ Ok ( ( ) )
128+ }
129+
120130 pub fn append ( & self , file : & Self ) -> Result < ( ) > {
121131 let sh = crate :: sh ( ) ?;
122132 let archive = self . as_ref ( ) ;
Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ impl Build {
3737 }
3838
3939 self . cargo_build . artifact . arch . install_for_build ( ) ?;
40+ let dist_archive = self . cargo_build . artifact . dist_archive ( ) ;
41+ sh. create_dir ( dist_archive. as_ref ( ) . parent ( ) . unwrap ( ) ) ?;
42+ sh. remove_path ( & dist_archive) ?;
43+ dist_archive. create ( ) ?;
4044
4145 let careful = match env:: var_os ( "HERMIT_CAREFUL" ) {
4246 Some ( val) if val == "1" => & [ "careful" ] [ ..] ,
@@ -58,14 +62,7 @@ impl Build {
5862 assert ! ( status. success( ) ) ;
5963
6064 let build_archive = self . cargo_build . artifact . build_archive ( ) ;
61- let dist_archive = self . cargo_build . artifact . dist_archive ( ) ;
62- eprintln ! (
63- "Copying {} to {}" ,
64- build_archive. as_ref( ) . display( ) ,
65- dist_archive. as_ref( ) . display( )
66- ) ;
67- sh. create_dir ( dist_archive. as_ref ( ) . parent ( ) . unwrap ( ) ) ?;
68- sh. copy_file ( & build_archive, & dist_archive) ?;
65+ dist_archive. append ( & build_archive) ?;
6966
7067 self . cargo_build . artifact . dist_archive ( ) . retain_kernel_symbols ( ) ?;
7168
You can’t perform that action at this time.
0 commit comments