Skip to content

Commit c26a45b

Browse files
committed
Auto merge of #1025 - rust-lang-nursery:db-show-manifest-version, r=brson
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.
2 parents c60e5e4 + edd013c commit c26a45b

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

src/rustup-dist/src/dist.rs

+1
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ pub fn update_from_dist_<'a>(download: DownloadCfg<'a>,
489489
(download.notify_handler)(Notification::DownloadingManifest(&toolchain_str));
490490
match dl_v2_manifest(download, update_hash, toolchain) {
491491
Ok(Some((m, hash))) => {
492+
(download.notify_handler)(Notification::DownloadedManifest(&m.date, m.get_rust_version().ok()));
492493
return match try!(manifestation.update(&m,
493494
changes,
494495
&download,

src/rustup-dist/src/manifest.rs

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ impl Manifest {
119119
|| format!("package not found: '{}'", name).into())
120120
}
121121

122+
pub fn get_rust_version(&self) -> Result<&str> {
123+
self.get_package("rust").map(|p| &*p.version)
124+
}
125+
122126
fn validate_targeted_package(&self, tpkg: &TargetedPackage) -> Result<()> {
123127
for c in tpkg.components.iter().chain(tpkg.extensions.iter()) {
124128
let cpkg = try!(self.get_package(&c.pkg).chain_err(|| ErrorKind::MissingPackageForComponent(c.clone())));

src/rustup-dist/src/notifications.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub enum Notification<'a> {
2828
InstallingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
2929
RemovingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
3030
DownloadingManifest(&'a str),
31+
DownloadedManifest(&'a str, Option<&'a str>),
3132
DownloadingLegacyManifest,
3233
ManifestChecksumFailedHack,
3334
}
@@ -59,7 +60,8 @@ impl<'a> Notification<'a> {
5960
RemovingComponent(_, _, _) |
6061
ComponentAlreadyInstalled(_) |
6162
ManifestChecksumFailedHack |
62-
RollingBack | DownloadingManifest(_) => NotificationLevel::Info,
63+
RollingBack | DownloadingManifest(_) |
64+
DownloadedManifest(_, _) => NotificationLevel::Info,
6365
CantReadUpdateHash(_) | ExtensionNotInstalled(_) |
6466
MissingInstalledComponent(_) | CachedFileChecksumFailed => NotificationLevel::Warn,
6567
NonFatalError(_) => NotificationLevel::Error,
@@ -115,6 +117,8 @@ impl<'a> Display for Notification<'a> {
115117
}
116118
}
117119
DownloadingManifest(t) => write!(f, "syncing channel updates for '{}'", t),
120+
DownloadedManifest(date, Some(version)) => write!(f, "latest update on {}, rust version {}", date, version),
121+
DownloadedManifest(date, None) => write!(f, "latest update on {}, no rust version", date),
118122
DownloadingLegacyManifest => write!(f, "manifest not found. trying legacy manifest"),
119123
ManifestChecksumFailedHack => write!(f, "update not yet available, sorry! try again later"),
120124
}

tests/cli-exact.rs

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ for_host!(r"
2727
2828
"),
2929
for_host!(r"info: syncing channel updates for 'nightly-{0}'
30+
info: latest update on 2015-01-02, rust version 1.3.0
3031
info: downloading component 'rust-std'
3132
info: downloading component 'rustc'
3233
info: downloading component 'cargo'
@@ -62,6 +63,7 @@ for_host!(r"
6263
6364
"),
6465
for_host!(r"info: syncing channel updates for 'nightly-{0}'
66+
info: latest update on 2015-01-02, rust version 1.3.0
6567
info: downloading component 'rust-std'
6668
info: downloading component 'rustc'
6769
info: downloading component 'cargo'
@@ -248,6 +250,7 @@ fn update_invalid_toolchain() {
248250
expect_err_ex(config, &["rustup", "update", "nightly-2016-03-1"],
249251
r"",
250252
r"info: syncing channel updates for 'nightly-2016-03-1'
253+
info: latest update on 2015-01-02, rust version 1.3.0
251254
error: target not found: '2016-03-1'
252255
");
253256
});
@@ -259,6 +262,7 @@ fn default_invalid_toolchain() {
259262
expect_err_ex(config, &["rustup", "default", "nightly-2016-03-1"],
260263
r"",
261264
r"info: syncing channel updates for 'nightly-2016-03-1'
265+
info: latest update on 2015-01-02, rust version 1.3.0
262266
error: target not found: '2016-03-1'
263267
");
264268
});

tests/cli-rustup.rs

+7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ for_host!(r"
3636
3737
"),
3838
for_host!(r"info: syncing channel updates for 'stable-{0}'
39+
info: latest update on 2015-01-02, rust version 1.1.0
3940
info: downloading component 'rust-std'
4041
info: downloading component 'rustc'
4142
info: downloading component 'cargo'
@@ -83,6 +84,7 @@ for_host!(r"
8384
8485
"),
8586
for_host!(r"info: syncing channel updates for 'stable-{0}'
87+
info: latest update on 2015-01-02, rust version 1.1.0
8688
info: downloading component 'rust-std'
8789
info: downloading component 'rustc'
8890
info: downloading component 'cargo'
@@ -96,6 +98,7 @@ info: installing component 'rustc'
9698
info: installing component 'cargo'
9799
info: installing component 'rust-docs'
98100
info: syncing channel updates for 'beta-{0}'
101+
info: latest update on 2015-01-02, rust version 1.2.0
99102
info: downloading component 'rust-std'
100103
info: downloading component 'rustc'
101104
info: downloading component 'cargo'
@@ -109,6 +112,7 @@ info: installing component 'rustc'
109112
info: installing component 'cargo'
110113
info: installing component 'rust-docs'
111114
info: syncing channel updates for 'nightly-{0}'
115+
info: latest update on 2015-01-02, rust version 1.3.0
112116
info: downloading component 'rust-std'
113117
info: downloading component 'rustc'
114118
info: downloading component 'cargo'
@@ -142,6 +146,7 @@ for_host!(r"
142146
143147
"),
144148
for_host!(r"info: syncing channel updates for 'stable-{0}'
149+
info: latest update on 2015-01-02, rust version 1.1.0
145150
info: downloading component 'rust-std'
146151
info: downloading component 'rustc'
147152
info: downloading component 'cargo'
@@ -156,6 +161,7 @@ info: installing component 'cargo'
156161
info: installing component 'rust-docs'
157162
info: syncing channel updates for 'beta-{0}'
158163
info: syncing channel updates for 'nightly-{0}'
164+
info: latest update on 2015-01-02, rust version 1.3.0
159165
info: downloading component 'rust-std'
160166
info: downloading component 'rustc'
161167
info: downloading component 'cargo'
@@ -193,6 +199,7 @@ for_host!(r"
193199
194200
"),
195201
for_host!(r"info: syncing channel updates for 'nightly-{0}'
202+
info: latest update on 2015-01-02, rust version 1.3.0
196203
info: downloading component 'rust-std'
197204
info: downloading component 'rustc'
198205
info: downloading component 'cargo'

tests/cli-self-upd.rs

+1
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ r"
758758
759759
",
760760
for_host!(r"info: syncing channel updates for 'stable-{0}'
761+
info: latest update on 2015-01-02, rust version 1.1.0
761762
info: downloading component 'rust-std'
762763
info: downloading component 'rustc'
763764
info: downloading component 'cargo'

0 commit comments

Comments
 (0)