@@ -211,7 +211,7 @@ impl Manifestation {
211
211
for result in results {
212
212
let ( bin, downloaded_file) = result?;
213
213
things_downloaded. push ( bin. binary . hash . clone ( ) ) ;
214
- things_to_install. push ( ( bin. component , bin . binary . compression , downloaded_file) ) ;
214
+ things_to_install. push ( ( bin, downloaded_file) ) ;
215
215
}
216
216
}
217
217
@@ -250,44 +250,15 @@ impl Manifestation {
250
250
}
251
251
252
252
// Install components
253
- for ( component, format, installer_file) in things_to_install {
254
- // For historical reasons, the rust-installer component
255
- // names are not the same as the dist manifest component
256
- // names. Some are just the component name some are the
257
- // component name plus the target triple.
258
- let pkg_name = component. name_in_manifest ( ) ;
259
- let short_pkg_name = component. short_name_in_manifest ( ) ;
260
- let short_name = component. short_name ( new_manifest) ;
261
-
262
- ( download_cfg. notify_handler ) ( Notification :: InstallingComponent (
263
- & short_name,
264
- & self . target_triple ,
265
- component. target . as_ref ( ) ,
266
- ) ) ;
267
-
268
- let cx = PackageContext {
253
+ for ( component_bin, installer_file) in things_to_install {
254
+ tx = self . install_component (
255
+ component_bin,
256
+ installer_file,
269
257
tmp_cx,
270
- notify_handler : Some ( download_cfg. notify_handler ) ,
271
- process : download_cfg. process ,
272
- } ;
273
-
274
- let reader = utils:: FileReaderWithProgress :: new_file (
275
- & installer_file,
276
- download_cfg. notify_handler ,
258
+ download_cfg,
259
+ new_manifest,
260
+ tx,
277
261
) ?;
278
- let package = match format {
279
- CompressionKind :: GZip => & TarGzPackage :: new ( reader, & cx) ? as & dyn Package ,
280
- CompressionKind :: XZ => & TarXzPackage :: new ( reader, & cx) ?,
281
- CompressionKind :: ZStd => & TarZStdPackage :: new ( reader, & cx) ?,
282
- } ;
283
-
284
- // If the package doesn't contain the component that the
285
- // manifest says it does then somebody must be playing a joke on us.
286
- if !package. contains ( & pkg_name, Some ( short_pkg_name) ) {
287
- return Err ( RustupError :: CorruptComponent ( short_name) . into ( ) ) ;
288
- }
289
-
290
- tx = package. install ( & self . installation , & pkg_name, Some ( short_pkg_name) , tx) ?;
291
262
}
292
263
293
264
// Install new distribution manifest
@@ -302,7 +273,7 @@ impl Manifestation {
302
273
// `Components` *also* tracks what is installed, but it only tracks names, not
303
274
// name/target. Needs to be fixed in rust-installer.
304
275
let new_config = Config {
305
- components : update. final_component_list ,
276
+ components : update. final_component_list . clone ( ) ,
306
277
..Config :: default ( )
307
278
} ;
308
279
let config_str = new_config. stringify ( ) ?;
@@ -526,6 +497,52 @@ impl Manifestation {
526
497
527
498
Ok ( tx)
528
499
}
500
+
501
+ fn install_component < ' a > (
502
+ & self ,
503
+ component_bin : ComponentBinary < ' a > ,
504
+ installer_file : File ,
505
+ tmp_cx : & temp:: Context ,
506
+ download_cfg : & DownloadCfg < ' _ > ,
507
+ new_manifest : & Manifest ,
508
+ tx : Transaction < ' a > ,
509
+ ) -> Result < Transaction < ' a > > {
510
+ // For historical reasons, the rust-installer component
511
+ // names are not the same as the dist manifest component
512
+ // names. Some are just the component name some are the
513
+ // component name plus the target triple.
514
+ let pkg_name = component_bin. component . name_in_manifest ( ) ;
515
+ let short_pkg_name = component_bin. component . short_name_in_manifest ( ) ;
516
+ let short_name = component_bin. component . short_name ( new_manifest) ;
517
+
518
+ ( download_cfg. notify_handler ) ( Notification :: InstallingComponent (
519
+ & short_name,
520
+ & self . target_triple ,
521
+ component_bin. component . target . as_ref ( ) ,
522
+ ) ) ;
523
+
524
+ let cx = PackageContext {
525
+ tmp_cx,
526
+ notify_handler : Some ( download_cfg. notify_handler ) ,
527
+ process : download_cfg. process ,
528
+ } ;
529
+
530
+ let reader =
531
+ utils:: FileReaderWithProgress :: new_file ( & installer_file, download_cfg. notify_handler ) ?;
532
+ let package = match component_bin. binary . compression {
533
+ CompressionKind :: GZip => & TarGzPackage :: new ( reader, & cx) ? as & dyn Package ,
534
+ CompressionKind :: XZ => & TarXzPackage :: new ( reader, & cx) ?,
535
+ CompressionKind :: ZStd => & TarZStdPackage :: new ( reader, & cx) ?,
536
+ } ;
537
+
538
+ // If the package doesn't contain the component that the
539
+ // manifest says it does then somebody must be playing a joke on us.
540
+ if !package. contains ( & pkg_name, Some ( short_pkg_name) ) {
541
+ return Err ( RustupError :: CorruptComponent ( short_name) . into ( ) ) ;
542
+ }
543
+
544
+ package. install ( & self . installation , & pkg_name, Some ( short_pkg_name) , tx)
545
+ }
529
546
}
530
547
531
548
#[ derive( Debug ) ]
0 commit comments