Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to update non-tracking channels. Fixes #422 #425

Merged
merged 1 commit into from
May 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/rustup/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,29 @@ impl Cfg {
pub fn update_all_channels(&self) -> Result<Vec<(String, Result<UpdateStatus>)>> {
let toolchains = try!(self.list_toolchains());

let updates = toolchains.into_iter()
.map(|name| {
let result = self.get_toolchain(&name, true)
.and_then(|t| t.install_from_dist());
if let Err(ref e) = result {
// Convert the toolchain strings to Toolchain values
let toolchains = toolchains.into_iter();
let toolchains = toolchains.map(|n| (n.clone(), self.get_toolchain(&n, true)));

// Filter out toolchains that don't track a release channel
let toolchains = toolchains.filter(|&(_, ref t)| {
t.as_ref().map(|t| t.is_tracking()).unwrap_or(false)
});

// Update toolchains and collect the results
let toolchains = toolchains.map(|(n, t)| {
let t = t.and_then(|t| {
let t = t.install_from_dist();
if let Err(ref e) = t {
self.notify_handler.call(Notification::NonFatalError(e));
}
(name, result)
}).collect();
t
});

Ok(updates)
(n, t)
});

Ok(toolchains.collect())
}

pub fn check_metadata_version(&self) -> Result<()> {
Expand Down
15 changes: 15 additions & 0 deletions tests/cli-rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,18 @@ fn show_toolchain_env_not_installed() {
assert!(stderr.starts_with("error: toolchain 'nightly' is not installed\n"));
});
}

// #422
#[test]
fn update_doesnt_update_non_tracking_channels() {
setup(&|config| {
expect_ok(config, &["rustup", "default", "nightly"]);
expect_ok(config, &["rustup", "update", "nightly-2015-01-01"]);
let mut cmd = clitools::cmd(config, "rustup", &["update"]);
clitools::env(config, &mut cmd);
let out = cmd.output().unwrap();
let stderr = String::from_utf8(out.stderr).unwrap();
assert!(!stderr.contains(
for_host!("syncing channel updates for 'nightly-2015-01-01-{}'")));
});
}