Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/dist/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl<'a> DownloadCfg<'a> {
let progress = ProgressBar::hidden();
progress.set_style(
ProgressStyle::with_template(
"{msg:>12.bold} [{bar:40}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
"{msg:>12.bold} [{bar:30}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
)
.unwrap()
.progress_chars("## "),
Expand Down Expand Up @@ -260,7 +260,7 @@ impl DownloadStatus {
*retry_time = None;
self.progress.set_style(
ProgressStyle::with_template(
"{msg:>12.bold} [{bar:40}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
"{msg:>12.bold} [{bar:30}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
)
.unwrap()
.progress_chars("## "),
Expand All @@ -269,10 +269,10 @@ impl DownloadStatus {

pub(crate) fn finished(&self) {
self.progress.set_style(
ProgressStyle::with_template("{msg:>12.bold} downloaded {total_bytes} in {elapsed}")
ProgressStyle::with_template("{msg:>12.bold} pending installation {total_bytes:>10}")
.unwrap(),
);
self.progress.finish();
self.progress.tick(); // A tick is needed for the new style to appear, as it is static.
}

pub(crate) fn failed(&self) {
Expand All @@ -285,8 +285,27 @@ impl DownloadStatus {

pub(crate) fn retrying(&self) {
*self.retry_time.lock().unwrap() = Some(Instant::now());
self.progress
.set_style(ProgressStyle::with_template("{msg:>12.bold} retrying download").unwrap());
self.progress.set_style(
ProgressStyle::with_template("{msg:>12.bold} retrying download...").unwrap(),
);
}

pub(crate) fn installing(&self) {
self.progress.set_style(
ProgressStyle::with_template(
"{msg:>12.bold} installing {spinner:.green} {total_bytes:>18}",
)
.unwrap()
.tick_chars(r"|/-\ "),
);
self.progress.enable_steady_tick(Duration::from_millis(100));
}

pub(crate) fn installed(&self) {
self.progress.set_style(
ProgressStyle::with_template("{msg:>12.bold} installed {total_bytes:>21}").unwrap(),
);
self.progress.finish();
}
}

Expand Down
18 changes: 5 additions & 13 deletions src/dist/manifestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,17 +744,7 @@ impl<'a> ComponentBinary<'a> {
let short_pkg_name = component.short_name_in_manifest();
let short_name = component.short_name(new_manifest);

match &component.target {
Some(t) if t != &manifestation.target_triple => {
info!("installing component {short_name}");
}
_ => {
info!(
"installing component {short_name} for target {}",
manifestation.target_triple
)
}
}
self.status.installing();

let reader = utils::FileReaderWithProgress::new_file(&installer_file)?;
let package = match self.binary.compression {
Expand All @@ -769,11 +759,13 @@ impl<'a> ComponentBinary<'a> {
return Err(RustupError::CorruptComponent(short_name).into());
}

package.install(
let tx = package.install(
&manifestation.installation,
&pkg_name,
Some(short_pkg_name),
tx,
)
);
self.status.installed();
tx
}
}