Skip to content

Commit 80ea54a

Browse files
committed
Merge pull request #167 from brson/crossmsg
More informative infos for target installation
2 parents 9fdd25e + 073aee3 commit 80ea54a

File tree

3 files changed

+42
-10
lines changed

3 files changed

+42
-10
lines changed

src/multirust-dist/src/errors.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ pub enum Notification<'a> {
2424
ExtensionNotInstalled(&'a Component),
2525
NonFatalError(&'a Error),
2626
MissingInstalledComponent(&'a str),
27-
DownloadingComponent(&'a str),
28-
InstallingComponent(&'a str),
27+
DownloadingComponent(&'a str, &'a str, &'a str),
28+
InstallingComponent(&'a str, &'a str, &'a str),
2929
DownloadingManifest(&'a str),
3030
DownloadingLegacyManifest,
3131
}
@@ -101,8 +101,8 @@ impl<'a> Notification<'a> {
101101
ChecksumValid(_) | NoUpdateHash(_) |
102102
DownloadingLegacyManifest => NotificationLevel::Verbose,
103103
Extracting(_, _) | SignatureValid(_) |
104-
DownloadingComponent(_) |
105-
InstallingComponent(_) |
104+
DownloadingComponent(_, _, _) |
105+
InstallingComponent(_, _, _) |
106106
ComponentAlreadyInstalled(_) |
107107
RollingBack | DownloadingManifest(_) => NotificationLevel::Info,
108108
CantReadUpdateHash(_) | ExtensionNotInstalled(_) |
@@ -137,8 +137,20 @@ impl<'a> Display for Notification<'a> {
137137
}
138138
NonFatalError(e) => write!(f, "{}", e),
139139
MissingInstalledComponent(c) => write!(f, "during uninstall component {} was not found", c),
140-
DownloadingComponent(c) => write!(f, "downloading component '{}'", c),
141-
InstallingComponent(c) => write!(f, "installing component '{}'", c),
140+
DownloadingComponent(c, h, t) => {
141+
if h == t {
142+
write!(f, "downloading component '{}'", c)
143+
} else {
144+
write!(f, "downloading component '{}' for '{}'", c, t)
145+
}
146+
}
147+
InstallingComponent(c, h, t) => {
148+
if h == t {
149+
write!(f, "installing component '{}'", c)
150+
} else {
151+
write!(f, "installing component '{}' for '{}'", c, t)
152+
}
153+
}
142154
DownloadingManifest(t) => write!(f, "syncing channel updates for '{}'", t),
143155
DownloadingLegacyManifest => write!(f, "manifest not found. trying legacy manifest"),
144156
}

src/multirust-dist/src/manifestation.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ impl Manifestation {
126126
let mut things_to_install: Vec<(Component, temp::File)> = Vec::new();
127127
for (component, url, hash) in components_urls_and_hashes {
128128

129-
notify_handler.call(Notification::DownloadingComponent(&component.pkg));
129+
notify_handler.call(Notification::DownloadingComponent(&component.pkg,
130+
&self.target_triple,
131+
&component.target));
130132

131133
// Download each package to temp file
132134
let temp_file = try!(temp_cfg.new_file());
@@ -170,7 +172,9 @@ impl Manifestation {
170172
// Install components
171173
for (component, installer_file) in things_to_install {
172174

173-
notify_handler.call(Notification::InstallingComponent(&component.pkg));
175+
notify_handler.call(Notification::InstallingComponent(&component.pkg,
176+
&self.target_triple,
177+
&component.target));
174178

175179
let package = try!(TarGzPackage::new_file(&installer_file, temp_cfg));
176180

@@ -297,7 +301,9 @@ impl Manifestation {
297301
}
298302
let url = url.unwrap();
299303

300-
notify_handler.call(Notification::DownloadingComponent("rust"));
304+
notify_handler.call(Notification::DownloadingComponent("rust",
305+
&self.target_triple,
306+
&self.target_triple));
301307

302308
let dlcfg = DownloadCfg {
303309
dist_root: "bogus",
@@ -313,7 +319,9 @@ impl Manifestation {
313319

314320
let prefix = self.installation.prefix();
315321

316-
notify_handler.call(Notification::InstallingComponent("rust"));
322+
notify_handler.call(Notification::InstallingComponent("rust",
323+
&self.target_triple,
324+
&self.target_triple));
317325

318326
// Begin transaction
319327
let mut tx = Transaction::new(prefix.clone(), temp_cfg, notify_handler);

tests/cli-exact.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,15 @@ fn list_targets() {
176176
r"");
177177
});
178178
}
179+
180+
#[test]
181+
fn cross_install_indicates_target() {
182+
setup(&|config| {
183+
expect_ok(config, &["rustup", "default", "nightly"]);
184+
expect_ok_ex(config, &["rustup", "target", "add", clitools::CROSS_ARCH1],
185+
r"",
186+
&format!(r"info: downloading component 'rust-std' for '{0}'
187+
info: installing component 'rust-std' for '{0}'
188+
", clitools::CROSS_ARCH1));
189+
});
190+
}

0 commit comments

Comments
 (0)