Skip to content

Commit

Permalink
Auto merge of #1025 - rust-lang-nursery:db-show-manifest-version, r=b…
Browse files Browse the repository at this point in the history
…rson

Show version of rust being installed

Fixes #1007

I haven't updated the tests yet in case we want to change how it's displayed.
  • Loading branch information
bors committed May 29, 2017
2 parents c60e5e4 + edd013c commit ef63df3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/rustup-dist/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ pub fn update_from_dist_<'a>(download: DownloadCfg<'a>,
(download.notify_handler)(Notification::DownloadingManifest(&toolchain_str));
match dl_v2_manifest(download, update_hash, toolchain) {
Ok(Some((m, hash))) => {
(download.notify_handler)(Notification::DownloadedManifest(&m.date, m.get_rust_version().ok()));
return match try!(manifestation.update(&m,
changes,
&download,
Expand Down
4 changes: 4 additions & 0 deletions src/rustup-dist/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ impl Manifest {
|| format!("package not found: '{}'", name).into())
}

pub fn get_rust_version(&self) -> Result<&str> {
self.get_package("rust").map(|p| &*p.version)
}

fn validate_targeted_package(&self, tpkg: &TargetedPackage) -> Result<()> {
for c in tpkg.components.iter().chain(tpkg.extensions.iter()) {
let cpkg = try!(self.get_package(&c.pkg).chain_err(|| ErrorKind::MissingPackageForComponent(c.clone())));
Expand Down
6 changes: 5 additions & 1 deletion src/rustup-dist/src/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub enum Notification<'a> {
InstallingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
RemovingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
DownloadingManifest(&'a str),
DownloadedManifest(&'a str, Option<&'a str>),
DownloadingLegacyManifest,
ManifestChecksumFailedHack,
}
Expand Down Expand Up @@ -59,7 +60,8 @@ impl<'a> Notification<'a> {
RemovingComponent(_, _, _) |
ComponentAlreadyInstalled(_) |
ManifestChecksumFailedHack |
RollingBack | DownloadingManifest(_) => NotificationLevel::Info,
RollingBack | DownloadingManifest(_) |
DownloadedManifest(_, _) => NotificationLevel::Info,
CantReadUpdateHash(_) | ExtensionNotInstalled(_) |
MissingInstalledComponent(_) | CachedFileChecksumFailed => NotificationLevel::Warn,
NonFatalError(_) => NotificationLevel::Error,
Expand Down Expand Up @@ -115,6 +117,8 @@ impl<'a> Display for Notification<'a> {
}
}
DownloadingManifest(t) => write!(f, "syncing channel updates for '{}'", t),
DownloadedManifest(date, Some(version)) => write!(f, "latest update on {}, rust version {}", date, version),
DownloadedManifest(date, None) => write!(f, "latest update on {}, no rust version", date),
DownloadingLegacyManifest => write!(f, "manifest not found. trying legacy manifest"),
ManifestChecksumFailedHack => write!(f, "update not yet available, sorry! try again later"),
}
Expand Down
4 changes: 4 additions & 0 deletions tests/cli-exact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ for_host!(r"
"),
for_host!(r"info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand Down Expand Up @@ -62,6 +63,7 @@ for_host!(r"
"),
for_host!(r"info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand Down Expand Up @@ -248,6 +250,7 @@ fn update_invalid_toolchain() {
expect_err_ex(config, &["rustup", "update", "nightly-2016-03-1"],
r"",
r"info: syncing channel updates for 'nightly-2016-03-1'
info: latest update on 2015-01-02, rust version 1.3.0
error: target not found: '2016-03-1'
");
});
Expand All @@ -259,6 +262,7 @@ fn default_invalid_toolchain() {
expect_err_ex(config, &["rustup", "default", "nightly-2016-03-1"],
r"",
r"info: syncing channel updates for 'nightly-2016-03-1'
info: latest update on 2015-01-02, rust version 1.3.0
error: target not found: '2016-03-1'
");
});
Expand Down
7 changes: 7 additions & 0 deletions tests/cli-rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ for_host!(r"
"),
for_host!(r"info: syncing channel updates for 'stable-{0}'
info: latest update on 2015-01-02, rust version 1.1.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand Down Expand Up @@ -83,6 +84,7 @@ for_host!(r"
"),
for_host!(r"info: syncing channel updates for 'stable-{0}'
info: latest update on 2015-01-02, rust version 1.1.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand All @@ -96,6 +98,7 @@ info: installing component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: syncing channel updates for 'beta-{0}'
info: latest update on 2015-01-02, rust version 1.2.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand All @@ -109,6 +112,7 @@ info: installing component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand Down Expand Up @@ -142,6 +146,7 @@ for_host!(r"
"),
for_host!(r"info: syncing channel updates for 'stable-{0}'
info: latest update on 2015-01-02, rust version 1.1.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand All @@ -156,6 +161,7 @@ info: installing component 'cargo'
info: installing component 'rust-docs'
info: syncing channel updates for 'beta-{0}'
info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand Down Expand Up @@ -193,6 +199,7 @@ for_host!(r"
"),
for_host!(r"info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand Down
1 change: 1 addition & 0 deletions tests/cli-self-upd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ r"
",
for_host!(r"info: syncing channel updates for 'stable-{0}'
info: latest update on 2015-01-02, rust version 1.1.0
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'cargo'
Expand Down

0 comments on commit ef63df3

Please sign in to comment.