From 99c9e1c6a6cd20f9c67257c09bedb55bbbf9782b Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Sat, 1 Apr 2017 18:25:07 +0100 Subject: [PATCH 1/2] Show version of rust being installed --- src/rustup-dist/src/dist.rs | 1 + src/rustup-dist/src/manifest.rs | 4 ++++ src/rustup-dist/src/notifications.rs | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rustup-dist/src/dist.rs b/src/rustup-dist/src/dist.rs index 581acf7003a..10d5e557d17 100644 --- a/src/rustup-dist/src/dist.rs +++ b/src/rustup-dist/src/dist.rs @@ -634,6 +634,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, diff --git a/src/rustup-dist/src/manifest.rs b/src/rustup-dist/src/manifest.rs index 5fc5404fac7..2a20295a120 100644 --- a/src/rustup-dist/src/manifest.rs +++ b/src/rustup-dist/src/manifest.rs @@ -117,6 +117,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()))); diff --git a/src/rustup-dist/src/notifications.rs b/src/rustup-dist/src/notifications.rs index 44580597f2e..9191f4ebf78 100644 --- a/src/rustup-dist/src/notifications.rs +++ b/src/rustup-dist/src/notifications.rs @@ -27,6 +27,7 @@ pub enum Notification<'a> { DownloadingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>), InstallingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>), DownloadingManifest(&'a str), + DownloadedManifest(&'a str, Option<&'a str>), DownloadingLegacyManifest, ManifestChecksumFailedHack, } @@ -57,7 +58,8 @@ impl<'a> Notification<'a> { InstallingComponent(_, _, _) | ComponentAlreadyInstalled(_) | ManifestChecksumFailedHack | - RollingBack | DownloadingManifest(_) => NotificationLevel::Info, + RollingBack | DownloadingManifest(_) | + DownloadedManifest(_, _) => NotificationLevel::Info, CantReadUpdateHash(_) | ExtensionNotInstalled(_) | MissingInstalledComponent(_) | CachedFileChecksumFailed => NotificationLevel::Warn, NonFatalError(_) => NotificationLevel::Error, @@ -106,6 +108,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"), } From edd013cf8d3a6279b2598546da9c824352fa1bc7 Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Mon, 29 May 2017 14:34:48 +0100 Subject: [PATCH 2/2] Update tests --- tests/cli-exact.rs | 4 ++++ tests/cli-rustup.rs | 7 +++++++ tests/cli-self-upd.rs | 1 + 3 files changed, 12 insertions(+) diff --git a/tests/cli-exact.rs b/tests/cli-exact.rs index 17a76f5dbf8..d9e550e39c5 100644 --- a/tests/cli-exact.rs +++ b/tests/cli-exact.rs @@ -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' @@ -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' @@ -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' "); }); @@ -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' "); }); diff --git a/tests/cli-rustup.rs b/tests/cli-rustup.rs index 0dab4a693e7..7d8f0f2dc16 100644 --- a/tests/cli-rustup.rs +++ b/tests/cli-rustup.rs @@ -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' @@ -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' @@ -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' @@ -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' @@ -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' @@ -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' @@ -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' diff --git a/tests/cli-self-upd.rs b/tests/cli-self-upd.rs index 3860c8672a3..854e2fdaa77 100644 --- a/tests/cli-self-upd.rs +++ b/tests/cli-self-upd.rs @@ -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'