File tree Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,24 @@ impl<'a> OmaRefresh<'a> {
216
216
let paths = if let Some ( ref paths) = self . sources_lists_paths {
217
217
paths. to_vec ( )
218
218
} else {
219
- scan_sources_lists_paths_from_sysroot ( & self . source )
219
+ #[ cfg( feature = "apt" ) ]
220
+ self . apt_config . set ( "Dir" , & self . source . to_string_lossy ( ) ) ;
221
+
222
+ #[ cfg( feature = "apt" ) ]
223
+ let list_file = self . apt_config . file ( "Dir::Etc::sourcelist" , "sources.list" ) ;
224
+
225
+ #[ cfg( feature = "apt" ) ]
226
+ let list_dir = self
227
+ . apt_config
228
+ . dir ( "Dir::Etc::sourceparts" , "sources.list.d" ) ;
229
+
230
+ #[ cfg( not( feature = "apt" ) ) ]
231
+ let list_file = self . source . join ( "etc/apt/sources.list" ) ;
232
+
233
+ #[ cfg( not( feature = "apt" ) ) ]
234
+ let list_dir = self . source . join ( "etc/apt/sources.list.d" ) ;
235
+
236
+ scan_sources_lists_paths_from_sysroot ( list_file, list_dir)
220
237
. await
221
238
. map_err ( RefreshError :: ScanSourceError ) ?
222
239
} ;
Original file line number Diff line number Diff line change @@ -55,24 +55,26 @@ impl Debug for OmaSourceEntry<'_> {
55
55
}
56
56
57
57
pub ( crate ) async fn scan_sources_lists_paths_from_sysroot (
58
- sysroot : impl AsRef < Path > ,
58
+ list_file : impl AsRef < str > ,
59
+ list_dir : impl AsRef < str > ,
59
60
) -> Result < Vec < PathBuf > , SourcesListError > {
60
61
let mut paths = vec ! [ ] ;
61
- let default = sysroot. as_ref ( ) . join ( "etc/apt/sources.list" ) ;
62
+ let default = Path :: new ( list_file. as_ref ( ) ) ;
63
+ let list_dir_path = Path :: new ( list_dir. as_ref ( ) ) ;
62
64
63
65
if default. exists ( ) {
64
- paths. push ( default) ;
66
+ paths. push ( default. to_path_buf ( ) ) ;
65
67
}
66
68
67
- if sysroot . as_ref ( ) . join ( "etc/apt/sources.list.d/" ) . exists ( ) {
68
- let mut dir = tokio:: fs:: read_dir ( sysroot . as_ref ( ) . join ( "etc/apt/sources.list.d/" ) ) . await ?;
69
+ if list_dir_path . exists ( ) {
70
+ let mut dir = tokio:: fs:: read_dir ( list_dir_path ) . await ?;
69
71
while let Some ( entry) = dir. next_entry ( ) . await ? {
70
72
let path = entry. path ( ) ;
71
73
if !path. is_file ( ) {
72
74
continue ;
73
75
}
74
76
75
- paths. push ( path) ;
77
+ paths. push ( path. to_path_buf ( ) ) ;
76
78
}
77
79
}
78
80
You can’t perform that action at this time.
0 commit comments