File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -28,24 +28,25 @@ use std::process::Command;
28
28
29
29
const MKL_ARCHIVE : & ' static str = "mkl.tar.xz" ;
30
30
31
- fn get_branch_name < P : AsRef < Path > > ( crate_dir : P ) -> String {
31
+ fn get_oid < P : AsRef < Path > > ( crate_dir : P ) -> String {
32
32
let repo = git2:: Repository :: open ( crate_dir) . unwrap ( ) ;
33
33
let head = repo. head ( ) . unwrap ( ) ;
34
- head. shorthand ( ) . unwrap ( ) . to_string ( )
34
+ head. target ( ) . unwrap ( ) . to_string ( )
35
35
}
36
36
37
37
fn main ( ) {
38
38
let out_dir = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
39
39
let crate_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
40
- let branch_name = get_branch_name ( & crate_dir) ;
41
- if !out_dir. join ( MKL_ARCHIVE ) . exists ( ) {
42
- Command :: new ( "wget" )
43
- . arg ( format ! ( "https://github.com/termoshtt/rust-intel-mkl/raw/{}/mkl_lib/mkl.tar.xz" ,
44
- branch_name) )
45
- . current_dir ( & out_dir)
46
- . status ( )
47
- . expect ( "Failed to start download (maybe 'wget' is missing?)" ) ;
48
- }
40
+ let oid = get_oid ( & crate_dir) ;
41
+ let uri = format ! ( "https://github.com/termoshtt/rust-intel-mkl/raw/{}/mkl_lib/{}" ,
42
+ oid,
43
+ MKL_ARCHIVE ) ;
44
+ println ! ( "Download URI = {}" , uri) ;
45
+ Command :: new ( "wget" )
46
+ . args ( & [ "-q" , & uri, "-O" , MKL_ARCHIVE ] )
47
+ . current_dir ( & out_dir)
48
+ . status ( )
49
+ . expect ( "Failed to start download (maybe 'wget' is missing?)" ) ;
49
50
Command :: new ( "tar" )
50
51
. args ( & [ "Jxvf" , MKL_ARCHIVE ] )
51
52
. current_dir ( & out_dir)
You can’t perform that action at this time.
0 commit comments