Commit 80532f2 1 parent ea36f12 commit 80532f2 Copy full SHA for 80532f2
File tree 2 files changed +23
-7
lines changed
2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -178,9 +178,14 @@ pub fn index(
178
178
tracing:: info!( "Could not read package record from {:?}" , p) ;
179
179
continue ;
180
180
} ;
181
- repodata
182
- . conda_packages
183
- . insert ( file_name. to_string_lossy ( ) . to_string ( ) , record) ;
181
+ match t {
182
+ ArchiveType :: TarBz2 => repodata
183
+ . packages
184
+ . insert ( file_name. to_string_lossy ( ) . to_string ( ) , record) ,
185
+ ArchiveType :: Conda => repodata
186
+ . conda_packages
187
+ . insert ( file_name. to_string_lossy ( ) . to_string ( ) , record) ,
188
+ } ;
184
189
}
185
190
let out_file = output_folder. join ( platform) . join ( "repodata.json" ) ;
186
191
File :: create ( & out_file) ?. write_all ( serde_json:: to_string_pretty ( & repodata) ?. as_bytes ( ) ) ?;
Original file line number Diff line number Diff line change @@ -13,12 +13,19 @@ fn test_data_dir() -> PathBuf {
13
13
fn test_index ( ) {
14
14
let temp_dir = tempfile:: tempdir ( ) . unwrap ( ) ;
15
15
let subdir_path = Path :: new ( "win-64" ) ;
16
- let file_path = Path :: new ( "conda-22.11.1-py38haa244fe_1.conda" ) ;
16
+ let conda_file_path = Path :: new ( "conda-22.11.1-py38haa244fe_1.conda" ) ;
17
17
let index_json_path = Path :: new ( "conda-22.11.1-py38haa244fe_1-index.json" ) ;
18
+ let tar_bz2_file_path = Path :: new ( "conda-22.9.0-py38haa244fe_2.tar.bz2" ) ;
19
+
18
20
fs:: create_dir ( temp_dir. path ( ) . join ( subdir_path) ) . unwrap ( ) ;
19
21
fs:: copy (
20
- test_data_dir ( ) . join ( file_path) ,
21
- temp_dir. path ( ) . join ( subdir_path) . join ( file_path) ,
22
+ test_data_dir ( ) . join ( conda_file_path) ,
23
+ temp_dir. path ( ) . join ( subdir_path) . join ( conda_file_path) ,
24
+ )
25
+ . unwrap ( ) ;
26
+ fs:: copy (
27
+ test_data_dir ( ) . join ( tar_bz2_file_path) ,
28
+ temp_dir. path ( ) . join ( subdir_path) . join ( tar_bz2_file_path) ,
22
29
)
23
30
. unwrap ( ) ;
24
31
@@ -41,7 +48,11 @@ fn test_index() {
41
48
. as_str( ) ,
42
49
Some ( "win-64" )
43
50
) ;
44
- assert ! ( repodata_json. get( "packages" ) . is_some( ) ) ;
51
+ assert ! ( repodata_json
52
+ . get( "packages" )
53
+ . unwrap( )
54
+ . get( "conda-22.9.0-py38haa244fe_2.tar.bz2" )
55
+ . is_some( ) ) ;
45
56
assert_eq ! (
46
57
repodata_json
47
58
. get( "packages.conda" )
You can’t perform that action at this time.
0 commit comments