Skip to content

Commit 85d670e

Browse files
committed
UX: Ensure 'skipping nightly' messages use rename table
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
1 parent 5674652 commit 85d670e

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/dist/dist.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,11 @@ fn update_from_dist_<'a>(
686686
old_manifest
687687
};
688688

689+
let current_manifest = {
690+
let manifestation = Manifestation::open(prefix.clone(), toolchain.target.clone())?;
691+
manifestation.load_manifest()?
692+
};
693+
689694
loop {
690695
match try_update_from_dist_(
691696
download,
@@ -704,9 +709,13 @@ fn update_from_dist_<'a>(
704709
break Err(e);
705710
}
706711

707-
if let ErrorKind::RequestedComponentsUnavailable(components, ..) = e.kind() {
712+
if let ErrorKind::RequestedComponentsUnavailable(components, manifest, ..) =
713+
e.kind()
714+
{
708715
(download.notify_handler)(Notification::SkippingNightlyMissingComponent(
709-
&toolchain, components,
716+
&toolchain,
717+
current_manifest.as_ref().unwrap_or(manifest),
718+
components,
710719
));
711720

712721
if first_err.is_none() {

src/dist/notifications.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use crate::utils::notify::NotificationLevel;
77
use std::fmt::{self, Display};
88
use std::path::Path;
99

10+
use super::manifest::Manifest;
11+
1012
#[derive(Debug)]
1113
pub enum Notification<'a> {
1214
Utils(crate::utils::Notification<'a>),
@@ -31,7 +33,7 @@ pub enum Notification<'a> {
3133
DownloadingManifest(&'a str),
3234
DownloadedManifest(&'a str, Option<&'a str>),
3335
DownloadingLegacyManifest,
34-
SkippingNightlyMissingComponent(&'a ToolchainDesc, &'a [Component]),
36+
SkippingNightlyMissingComponent(&'a ToolchainDesc, &'a Manifest, &'a [Component]),
3537
ForcingUnavailableComponent(&'a str),
3638
ManifestChecksumFailedHack,
3739
ComponentUnavailable(&'a str, Option<&'a TargetTriple>),
@@ -72,7 +74,7 @@ impl<'a> Notification<'a> {
7274
| ManifestChecksumFailedHack
7375
| RollingBack
7476
| DownloadingManifest(_)
75-
| SkippingNightlyMissingComponent(_, _)
77+
| SkippingNightlyMissingComponent(_, _, _)
7678
| RetryingDownload(_)
7779
| DownloadedManifest(_, _) => NotificationLevel::Info,
7880
CantReadUpdateHash(_)
@@ -174,17 +176,17 @@ impl<'a> Display for Notification<'a> {
174176
"removing stray hash found at '{}' in order to continue",
175177
path.display()
176178
),
177-
SkippingNightlyMissingComponent(toolchain, components) => write!(
179+
SkippingNightlyMissingComponent(toolchain, manifest, components) => write!(
178180
f,
179181
"skipping nightly which is missing installed component{} '{}'",
180182
if components.len() > 1 { "s" } else { "" },
181183
components
182184
.iter()
183185
.map(|component| {
184186
if component.target.as_ref() != Some(&toolchain.target) {
185-
component.name_in_manifest()
187+
component.name(manifest)
186188
} else {
187-
component.short_name_in_manifest().to_owned()
189+
component.short_name(manifest).to_owned()
188190
}
189191
})
190192
.collect::<Vec<_>>()

tests/mock/clitools.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,10 @@ fn create_mock_dist_server(path: &Path, s: Scenario) {
818818
Release::new("nightly", "1.3.0", "2019-12-10", "2").only_multi_arch(),
819819
],
820820
Scenario::MissingComponentMulti => vec![
821-
Release::new("nightly", "1.37.0", "2019-09-12", "1").multi_arch(),
822-
Release::new("nightly", "1.37.0", "2019-09-13", "2"),
821+
Release::new("nightly", "1.37.0", "2019-09-12", "1")
822+
.multi_arch()
823+
.with_rls(RlsStatus::Renamed),
824+
Release::new("nightly", "1.37.0", "2019-09-13", "2").with_rls(RlsStatus::Renamed),
823825
Release::new("nightly", "1.37.0", "2019-09-14", "3")
824826
.multi_arch()
825827
.with_rls(RlsStatus::Unavailable),

0 commit comments

Comments
 (0)