@@ -31,7 +31,7 @@ pub struct Store {
3131 // The "Upstream" RepoType
3232 pub kind : RepoType ,
3333 /// Path to the Repo, can be a network location depending on `kind`
34- pub repo_path : String ,
34+ pub repos : Vec < String > ,
3535 /// The cache directory is currently only used with networked based `RepoType`, but may be used a future release.
3636 pub cache_path : PathBuf ,
3737 /// The directory where all installed artifacts will be under, alongside the CAS System itself.
@@ -264,18 +264,19 @@ fn resolve_repo_path(store: &Store, path: &String) -> Result<PathBuf> {
264264 . ok_or_else ( || anyhow:: anyhow!( "Failed to get parent directory" ) ) ?;
265265 create_dir_all ( parent) ?;
266266
267- match store. kind {
268- RepoType :: Https => {
269- network:: download_file ( & store. repo_path , & store. cache_path . join ( path) ) . map ( |_| ( ) )
267+ for repo in & store. repos {
268+ match store. kind {
269+ RepoType :: Https => {
270+ network:: download_file ( repo, & store. cache_path . join ( path) ) . map ( |_| ( ) )
271+ }
272+ RepoType :: Local => {
273+ fs:: copy ( PathBuf :: from ( & repo) . join ( path) , store. cache_path . join ( path) )
274+ . map ( |_| ( ) )
275+ . map_err ( |e| anyhow:: anyhow!( e) )
276+ }
270277 }
271- RepoType :: Local => fs:: copy (
272- PathBuf :: from ( & store. repo_path ) . join ( path) ,
273- store. cache_path . join ( path) ,
274- )
275- . map ( |_| ( ) )
276- . map_err ( |e| anyhow:: anyhow!( e) ) ,
278+ . with_context ( || format ! ( "Couldn't get {path} from {repo}" ) ) ?;
277279 }
278- . with_context ( || format ! ( "Couldn't get {path} from {}" , & store. repo_path) ) ?;
279280
280281 Ok ( store. cache_path . join ( path) )
281282}
@@ -387,7 +388,7 @@ mod tests {
387388 cache_path : cache,
388389 kind : RepoType :: Local ,
389390 path : store_path,
390- repo_path : repo. to_string_lossy ( ) . to_string ( ) ,
391+ repos : vec ! [ repo. to_string_lossy( ) . to_string( ) ] ,
391392 } ;
392393 create_repo ( & repo) . unwrap ( ) ;
393394 create_store ( & store) . unwrap ( ) ;
@@ -519,7 +520,7 @@ mod tests {
519520
520521 build (
521522 & input_dir,
522- & PathBuf :: from ( & store. repo_path ) ,
523+ & PathBuf :: from ( & store. repos . first ( ) . unwrap ( ) ) ,
523524 "test_artifact" ,
524525 )
525526 . unwrap ( ) ;
0 commit comments