Skip to content

Commit 76ac3af

Browse files
authored
Merge pull request #2197 from LeSeulArtichaut/component-info
Add component name when target is not equal to host
2 parents 6b0f44f + aa060cd commit 76ac3af

File tree

6 files changed

+210
-103
lines changed

6 files changed

+210
-103
lines changed

src/dist/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ fn update_from_dist_<'a>(
689689

690690
if let ErrorKind::RequestedComponentsUnavailable(components, ..) = e.kind() {
691691
(download.notify_handler)(Notification::SkippingNightlyMissingComponent(
692-
components,
692+
&toolchain, components,
693693
));
694694

695695
if first_err.is_none() {

src/dist/notifications.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::config::PgpPublicKey;
2-
use crate::dist::dist::TargetTriple;
2+
use crate::dist::dist::{TargetTriple, ToolchainDesc};
33
use crate::dist::manifest::Component;
44
use crate::dist::temp;
55
use crate::errors::*;
@@ -31,7 +31,7 @@ pub enum Notification<'a> {
3131
DownloadingManifest(&'a str),
3232
DownloadedManifest(&'a str, Option<&'a str>),
3333
DownloadingLegacyManifest,
34-
SkippingNightlyMissingComponent(&'a [Component]),
34+
SkippingNightlyMissingComponent(&'a ToolchainDesc, &'a [Component]),
3535
ForcingUnavailableComponent(&'a str),
3636
ManifestChecksumFailedHack,
3737
ComponentUnavailable(&'a str, Option<&'a TargetTriple>),
@@ -72,7 +72,7 @@ impl<'a> Notification<'a> {
7272
| ManifestChecksumFailedHack
7373
| RollingBack
7474
| DownloadingManifest(_)
75-
| SkippingNightlyMissingComponent(_)
75+
| SkippingNightlyMissingComponent(_, _)
7676
| RetryingDownload(_)
7777
| DownloadedManifest(_, _) => NotificationLevel::Info,
7878
CantReadUpdateHash(_)
@@ -174,13 +174,19 @@ impl<'a> Display for Notification<'a> {
174174
"removing stray hash found at '{}' in order to continue",
175175
path.display()
176176
),
177-
SkippingNightlyMissingComponent(components) => write!(
177+
SkippingNightlyMissingComponent(toolchain, components) => write!(
178178
f,
179179
"skipping nightly which is missing installed component{} '{}'",
180180
if components.len() > 1 { "s" } else { "" },
181181
components
182182
.iter()
183-
.map(|component| component.short_name_in_manifest().to_owned())
183+
.map(|component| {
184+
if component.target.as_ref() != Some(&toolchain.target) {
185+
component.name_in_manifest().to_owned()
186+
} else {
187+
component.short_name_in_manifest().to_owned()
188+
}
189+
})
184190
.collect::<Vec<_>>()
185191
.join("', '")
186192
),

tests/cli-exact.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,3 +533,62 @@ fn install_by_version_number() {
533533
expect_ok(config, &["rustup", "default", "0.100.99"]);
534534
})
535535
}
536+
537+
// issue #2191
538+
#[test]
539+
fn install_unreleased_component() {
540+
clitools::setup(Scenario::MissingComponentMulti, &|config| {
541+
// Initial channel content is host + rls + multiarch-std
542+
set_current_dist_date(config, "2019-09-12");
543+
expect_ok(config, &["rustup", "default", "nightly"]);
544+
expect_ok(config, &["rustup", "component", "add", "rls"]);
545+
expect_ok(config, &["rustup", "target", "add", clitools::MULTI_ARCH1]);
546+
547+
// Next channel variant should have host + rls but not multiarch-std
548+
set_current_dist_date(config, "2019-09-13");
549+
expect_ok_ex(
550+
config,
551+
&["rustup", "update", "nightly", "--no-self-update"],
552+
&for_host!(
553+
r"
554+
nightly-{} unchanged - 1.37.0 (hash-nightly-1)
555+
556+
"
557+
),
558+
&format!(
559+
r"info: syncing channel updates for 'nightly-{0}'
560+
info: latest update on 2019-09-13, rust version 1.37.0 (hash-nightly-2)
561+
info: skipping nightly which is missing installed component 'rust-std-{1}'
562+
info: syncing channel updates for 'nightly-2019-09-12-{0}'
563+
",
564+
clitools::this_host_triple(),
565+
clitools::MULTI_ARCH1
566+
),
567+
);
568+
569+
// Next channel variant should have host + multiarch-std but have rls missing
570+
set_current_dist_date(config, "2019-09-14");
571+
expect_ok_ex(
572+
config,
573+
&["rustup", "update", "nightly", "--no-self-update"],
574+
&for_host!(
575+
r"
576+
nightly-{} unchanged - 1.37.0 (hash-nightly-1)
577+
578+
"
579+
),
580+
&format!(
581+
r"info: syncing channel updates for 'nightly-{0}'
582+
info: latest update on 2019-09-14, rust version 1.37.0 (hash-nightly-3)
583+
info: skipping nightly which is missing installed component 'rls'
584+
info: syncing channel updates for 'nightly-2019-09-13-{0}'
585+
info: latest update on 2019-09-13, rust version 1.37.0 (hash-nightly-2)
586+
info: skipping nightly which is missing installed component 'rust-std-{1}'
587+
info: syncing channel updates for 'nightly-2019-09-12-{0}'
588+
",
589+
clitools::this_host_triple(),
590+
clitools::MULTI_ARCH1,
591+
),
592+
);
593+
})
594+
}

0 commit comments

Comments
 (0)