1
1
2
2
use ChrootBuilderResult ;
3
+ use Metadata ;
3
4
use utils:: source_path;
4
5
use regex:: Regex ;
5
6
@@ -40,6 +41,7 @@ pub fn add_package_into_database(conn: &Connection,
40
41
& TargetKind :: Lib ( _) => true ,
41
42
_ => false ,
42
43
} ;
44
+ let metadata = Metadata :: from_package ( pkg) ;
43
45
44
46
let release_id: i32 = {
45
47
let rows = try!( conn. query ( "SELECT id FROM releases WHERE crate_id = $1 AND version = $2" ,
@@ -53,11 +55,11 @@ pub fn add_package_into_database(conn: &Connection,
53
55
homepage_url, description, description_long, readme,
54
56
authors, keywords, have_examples, downloads, files,
55
57
doc_targets, is_library, doc_rustc_version,
56
- documentation_url
58
+ documentation_url, default_target
57
59
)
58
60
VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10,
59
61
$11, $12, $13, $14, $15, $16, $17, $18, $19,
60
- $20, $21, $22, $23, $24
62
+ $20, $21, $22, $23, $24, $25
61
63
)
62
64
RETURNING id" ,
63
65
& [ & crate_id,
@@ -83,7 +85,8 @@ pub fn add_package_into_database(conn: &Connection,
83
85
& doc_targets. to_json ( ) ,
84
86
& is_library,
85
87
& res. rustc_version ,
86
- & pkg. manifest ( ) . metadata ( ) . documentation ] ) ) ;
88
+ & pkg. manifest ( ) . metadata ( ) . documentation ,
89
+ & metadata. default_target ] ) ) ;
87
90
// return id
88
91
rows. get ( 0 ) . get ( 0 )
89
92
@@ -110,7 +113,8 @@ pub fn add_package_into_database(conn: &Connection,
110
113
doc_targets = $21,
111
114
is_library = $22,
112
115
doc_rustc_version = $23,
113
- documentation_url = $24
116
+ documentation_url = $24,
117
+ default_target = $25
114
118
WHERE crate_id = $1 AND version = $2" ,
115
119
& [ & crate_id,
116
120
& format ! ( "{}" , pkg. manifest( ) . version( ) ) ,
@@ -135,7 +139,8 @@ pub fn add_package_into_database(conn: &Connection,
135
139
& doc_targets. to_json ( ) ,
136
140
& is_library,
137
141
& res. rustc_version ,
138
- & pkg. manifest ( ) . metadata ( ) . documentation ] ) ) ;
142
+ & pkg. manifest ( ) . metadata ( ) . documentation ,
143
+ & metadata. default_target ] ) ) ;
139
144
rows. get ( 0 ) . get ( 0 )
140
145
}
141
146
} ;
0 commit comments