@@ -20,6 +20,7 @@ use crate::dist::config::Config;
2020use crate :: dist:: download:: { DownloadCfg , File } ;
2121use crate :: dist:: manifest:: { Component , CompressionKind , HashedBinary , Manifest , TargetedPackage } ;
2222use crate :: dist:: prefix:: InstallPrefix ;
23+ #[ cfg( test) ]
2324use crate :: dist:: temp;
2425use crate :: dist:: { DEFAULT_DIST_SERVER , Profile , TargetTriple } ;
2526use crate :: errors:: RustupError ;
@@ -428,9 +429,7 @@ impl Manifestation {
428429 & self ,
429430 new_manifest : & [ String ] ,
430431 update_hash : Option < & Path > ,
431- tmp_cx : & temp:: Context ,
432- notify_handler : & dyn Fn ( Notification < ' _ > ) ,
433- process : & Process ,
432+ dl_cfg : & DownloadCfg < ' _ > ,
434433 ) -> Result < Option < String > > {
435434 // If there's already a v2 installation then something has gone wrong
436435 if self . read_config ( ) ?. is_some ( ) {
@@ -451,25 +450,16 @@ impl Manifestation {
451450 // Only replace once. The cost is inexpensive.
452451 let url = url
453452 . unwrap ( )
454- . replace ( DEFAULT_DIST_SERVER , tmp_cx. dist_server . as_str ( ) ) ;
453+ . replace ( DEFAULT_DIST_SERVER , dl_cfg . tmp_cx . dist_server . as_str ( ) ) ;
455454
456- notify_handler ( Notification :: DownloadingComponent (
455+ ( dl_cfg . notify_handler ) ( Notification :: DownloadingComponent (
457456 "rust" ,
458457 & self . target_triple ,
459458 Some ( & self . target_triple ) ,
460459 & url,
461460 ) ) ;
462461
463- use std:: path:: PathBuf ;
464- let dld_dir = PathBuf :: from ( "bogus" ) ;
465- let dlcfg = DownloadCfg {
466- download_dir : & dld_dir,
467- tmp_cx,
468- notify_handler,
469- process,
470- } ;
471-
472- let dl = dlcfg
462+ let dl = dl_cfg
473463 . download_and_check ( & url, update_hash, ".tar.gz" )
474464 . await ?;
475465 if dl. is_none ( ) {
@@ -481,20 +471,21 @@ impl Manifestation {
481471 info ! ( "installing component rust" ) ;
482472
483473 // Begin transaction
484- let mut tx = Transaction :: new ( prefix, tmp_cx, process) ;
474+ let mut tx = Transaction :: new ( prefix, dl_cfg . tmp_cx , dl_cfg . process ) ;
485475
486476 // Uninstall components
487477 let components = self . installation . list ( ) ?;
488478 for component in components {
489- tx = component. uninstall ( tx, process) ?;
479+ tx = component. uninstall ( tx, dl_cfg . process ) ?;
490480 }
491481
492482 // Install all the components in the installer
493- let reader = utils:: FileReaderWithProgress :: new_file ( & installer_file, notify_handler) ?;
483+ let reader =
484+ utils:: FileReaderWithProgress :: new_file ( & installer_file, dl_cfg. notify_handler ) ?;
494485 let cx = PackageContext {
495- tmp_cx,
496- notify_handler : Some ( notify_handler) ,
497- process,
486+ tmp_cx : dl_cfg . tmp_cx ,
487+ notify_handler : Some ( dl_cfg . notify_handler ) ,
488+ process : dl_cfg . process ,
498489 } ;
499490
500491 let package: & dyn Package = & TarGzPackage :: new ( reader, & cx) ?;
0 commit comments