Skip to content

Commit

Permalink
Auto merge of #1119 - matthewjasper:removing-message, r=Diggsey
Browse files Browse the repository at this point in the history
Add a message when removing a component

Fixes #306.
The message is (for example)
```
info: removing component 'rust-std' for 'x86_64-unknown-linux-musl'
```
  • Loading branch information
bors committed May 18, 2017
2 parents 0ad45aa + 4eeaab3 commit 53a3ee1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rustup-dist/src/manifestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ impl Manifestation {

// Uninstall components
for component in components_to_uninstall {

notify_handler(Notification::RemovingComponent(&component.pkg,
&self.target_triple,
component.target.as_ref()));

tx = try!(self.uninstall_component(&component, tx, notify_handler.clone()));
}

Expand Down
9 changes: 9 additions & 0 deletions src/rustup-dist/src/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub enum Notification<'a> {
MissingInstalledComponent(&'a str),
DownloadingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
InstallingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
RemovingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
DownloadingManifest(&'a str),
DownloadingLegacyManifest,
ManifestChecksumFailedHack,
Expand Down Expand Up @@ -55,6 +56,7 @@ impl<'a> Notification<'a> {
Extracting(_, _) | SignatureValid(_) |
DownloadingComponent(_, _, _) |
InstallingComponent(_, _, _) |
RemovingComponent(_, _, _) |
ComponentAlreadyInstalled(_) |
ManifestChecksumFailedHack |
RollingBack | DownloadingManifest(_) => NotificationLevel::Info,
Expand Down Expand Up @@ -105,6 +107,13 @@ impl<'a> Display for Notification<'a> {
write!(f, "installing component '{}' for '{}'", c, t.unwrap())
}
}
RemovingComponent(c, h, t) => {
if Some(h) == t || t.is_none() {
write!(f, "removing component '{}'", c)
} else {
write!(f, "removing component '{}' for '{}'", c, t.unwrap())
}
}
DownloadingManifest(t) => write!(f, "syncing channel updates for '{}'", t),
DownloadingLegacyManifest => write!(f, "manifest not found. trying legacy manifest"),
ManifestChecksumFailedHack => write!(f, "update not yet available, sorry! try again later"),
Expand Down
24 changes: 24 additions & 0 deletions tests/cli-rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: removing component 'rust-std'
info: removing component 'rustc'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'cargo'
Expand Down Expand Up @@ -83,6 +87,10 @@ info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: removing component 'rust-std'
info: removing component 'rustc'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'cargo'
Expand All @@ -92,6 +100,10 @@ info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: removing component 'rust-std'
info: removing component 'rustc'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'cargo'
Expand All @@ -101,6 +113,10 @@ info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: removing component 'rust-std'
info: removing component 'rustc'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'cargo'
Expand Down Expand Up @@ -130,6 +146,10 @@ info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: removing component 'rust-std'
info: removing component 'rustc'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'cargo'
Expand All @@ -140,6 +160,10 @@ info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: removing component 'rust-std'
info: removing component 'rustc'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'cargo'
Expand Down

0 comments on commit 53a3ee1

Please sign in to comment.