Skip to content
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
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1513,9 +1513,12 @@ jobs:
- name: Install rustup stable
run: rustup toolchain install stable --profile minimal
- name: Install Protoc
uses: arduino/setup-protoc@v1
uses: arduino/setup-protoc@v3
env:
# renovate: datasource=github-releases depName=protocolbuffers/protobuf versioning=semver
PROTOBUF_VERSION: "34.1"
with:
version: "3.x"
version: ${{ env.PROTOBUF_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install OpenSSL
if: ${{ contains(matrix.os, 'windows') }}
Expand Down
7 changes: 5 additions & 2 deletions ci/actions-templates/all-features-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ jobs: # skip-all
- name: Install rustup stable
run: rustup toolchain install stable --profile minimal
- name: Install Protoc
uses: arduino/setup-protoc@v1
uses: arduino/setup-protoc@v3
env:
# renovate: datasource=github-releases depName=protocolbuffers/protobuf versioning=semver
PROTOBUF_VERSION: "34.1"
with:
version: "3.x"
version: ${{ env.PROTOBUF_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install OpenSSL
if: ${{ contains(matrix.os, 'windows') }}
Expand Down
56 changes: 34 additions & 22 deletions src/dist/manifestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,37 @@
#[cfg(test)]
mod tests;

use std::collections::VecDeque;
use std::path::Path;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll, ready};
use std::vec;
use std::{
collections::VecDeque,
path::Path,
pin::Pin,
sync::Arc,
task::{Context, Poll, ready},
vec,
};

use anyhow::{Context as _, Result, anyhow, bail};
use futures_util::Stream;
use futures_util::stream::{FuturesUnordered, StreamExt};
use futures_util::{
Stream,
stream::{FuturesUnordered, StreamExt},
};
use tokio::task::{JoinHandle, spawn_blocking};
use tracing::{debug, info, warn};

use crate::diskio::{Executor, IO_CHUNK_SIZE, get_executor, unpack_ram};
use crate::dist::component::{Components, DirectoryPackage, Transaction};
use crate::dist::config::Config;
use crate::dist::download::{DownloadCfg, DownloadStatus, File};
use crate::dist::manifest::{Component, CompressionKind, HashedBinary, Manifest};
use crate::dist::prefix::InstallPrefix;
use crate::dist::temp;
use crate::dist::{DEFAULT_DIST_SERVER, Profile, TargetTriple};
use crate::errors::RustupError;
use crate::utils;
use crate::{
diskio::{Executor, IO_CHUNK_SIZE, get_executor, unpack_ram},
dist::{
DEFAULT_DIST_SERVER, Profile, TargetTriple, ToolchainDesc,
component::{Components, DirectoryPackage, Transaction},
config::Config,
download::{DownloadCfg, DownloadStatus, File},
manifest::{Component, CompressionKind, HashedBinary, Manifest},
prefix::InstallPrefix,
temp,
},
errors::RustupError,
utils,
};

pub(crate) const DIST_MANIFEST: &str = "multirust-channel-manifest.toml";
pub(crate) const CONFIG_FILE: &str = "multirust-config.toml";
Expand Down Expand Up @@ -112,7 +120,7 @@ impl Manifestation {
changes: Changes,
force_update: bool,
download_cfg: &DownloadCfg<'_>,
toolchain_str: String,
toolchain: &ToolchainDesc,
implicit_modify: bool,
) -> Result<UpdateStatus> {
// Some vars we're going to need a few times
Expand All @@ -129,7 +137,7 @@ impl Manifestation {
}

// Validate that the requested components are available
if let Err(e) = update.unavailable_components(&new_manifest, &toolchain_str) {
if let Err(e) = update.unavailable_components(&new_manifest, toolchain) {
if !force_update {
return Err(e);
}
Expand Down Expand Up @@ -694,7 +702,11 @@ impl Update {
self.components_to_uninstall.is_empty() && self.components_to_install.is_empty()
}

fn unavailable_components(&self, new_manifest: &Manifest, toolchain_str: &str) -> Result<()> {
fn unavailable_components(
&self,
new_manifest: &Manifest,
toolchain: &ToolchainDesc,
) -> Result<()> {
let mut unavailable_components: Vec<Component> = self
.components_to_install
.iter()
Expand All @@ -715,7 +727,7 @@ impl Update {
bail!(RustupError::RequestedComponentsUnavailable {
components: unavailable_components,
manifest: new_manifest.clone(),
toolchain: toolchain_str.to_owned(),
toolchain: toolchain.to_string(),
});
}

Expand Down
19 changes: 6 additions & 13 deletions src/dist/manifestation/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,7 @@ impl TestContext {
};

manifestation
.update(
manifest,
changes,
force,
&dl_cfg,
self.toolchain.manifest_name(),
true,
)
.update(manifest, changes, force, &dl_cfg, &self.toolchain, true)
.await
}

Expand Down Expand Up @@ -660,7 +653,7 @@ async fn unavailable_component() {
manifest,
toolchain,
}) => {
assert_eq!(toolchain, "nightly");
assert_eq!(toolchain, "nightly-x86_64-apple-darwin");
let descriptions = components
.iter()
.map(|c| manifest.description(c))
Expand Down Expand Up @@ -705,7 +698,7 @@ async fn unavailable_component_from_profile() {
manifest,
toolchain,
}) => {
assert_eq!(toolchain, "nightly");
assert_eq!(toolchain, "nightly-x86_64-apple-darwin");
let descriptions = components
.iter()
.map(|c| manifest.description(c))
Expand Down Expand Up @@ -759,7 +752,7 @@ async fn removed_component() {
manifest,
toolchain,
}) => {
assert_eq!(toolchain, "nightly");
assert_eq!(toolchain, "nightly-x86_64-apple-darwin");
let descriptions = components
.iter()
.map(|c| manifest.description(c))
Expand Down Expand Up @@ -823,7 +816,7 @@ async fn unavailable_components_is_target() {
manifest,
toolchain,
}) => {
assert_eq!(toolchain, "nightly");
assert_eq!(toolchain, "nightly-x86_64-apple-darwin");
let descriptions = components
.iter()
.map(|c| manifest.description(c))
Expand Down Expand Up @@ -888,7 +881,7 @@ async fn unavailable_components_with_same_target() {
manifest,
toolchain,
}) => {
assert_eq!(toolchain, "nightly");
assert_eq!(toolchain, "nightly-x86_64-apple-darwin");
let descriptions = components
.iter()
.map(|c| manifest.description(c))
Expand Down
9 changes: 1 addition & 8 deletions src/dist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1199,14 +1199,7 @@ async fn try_update_from_dist_(
fetched.clone_from(&m.date);

return match manifestation
.update(
m,
changes,
force_update,
download,
toolchain.manifest_name(),
true,
)
.update(m, changes, force_update, download, toolchain, true)
.await
{
Ok(status) => match status {
Expand Down
18 changes: 2 additions & 16 deletions src/toolchain/distributable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,7 @@ impl<'a> DistributableToolchain<'a> {

let download_cfg = DownloadCfg::new(self.toolchain.cfg);
manifestation
.update(
manifest,
changes,
false,
&download_cfg,
self.desc.manifest_name(),
false,
)
.update(manifest, changes, false, &download_cfg, &self.desc, false)
.await?;

Ok(())
Expand Down Expand Up @@ -432,14 +425,7 @@ impl<'a> DistributableToolchain<'a> {

let download_cfg = DownloadCfg::new(self.toolchain.cfg);
manifestation
.update(
manifest,
changes,
false,
&download_cfg,
self.desc.manifest_name(),
false,
)
.update(manifest, changes, false, &download_cfg, &self.desc, false)
.await?;

Ok(())
Expand Down
20 changes: 10 additions & 10 deletions tests/suite/cli_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ async fn update_unavailable_std() {
.await
.with_stderr(snapbox::str![[r#"
...
error: component 'rust-std' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
error: component 'rust-std' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly-[HOST_TRIPLE]'
...
"#]])
.is_err();
Expand All @@ -1971,7 +1971,7 @@ async fn add_missing_component() {
.await
.with_stderr(snapbox::str![[r#"
...
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly-[HOST_TRIPLE]'
note: sometimes not all components are available in any given nightly
...
"#]])
Expand All @@ -1994,10 +1994,10 @@ async fn add_toolchain_with_missing_component() {
.await
.with_stderr(snapbox::str![[r#"
...
error: component 'rust-std' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
error: component 'rust-std' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly-[HOST_TRIPLE]'
note: sometimes not all components are available in any given nightly
help: if you don't need these components, you could try a minimal installation with:
help: rustup toolchain add nightly --profile minimal
help: rustup toolchain add nightly-[HOST_TRIPLE] --profile minimal
help: if you require these components, please install and use the latest successfully built version,
help: which you can find at <https://rust-lang.github.io/rustup-components-history>
help: after determining the correct date, install it with a command such as:
Expand All @@ -2020,10 +2020,10 @@ async fn add_toolchain_with_missing_components() {
.await
.with_stderr(snapbox::str![[r#"
...
error: some components are unavailable for download for channel 'nightly': 'cargo' for target '[HOST_TRIPLE]', 'rust-std' for target '[HOST_TRIPLE]'
error: some components are unavailable for download for channel 'nightly-[HOST_TRIPLE]': 'cargo' for target '[HOST_TRIPLE]', 'rust-std' for target '[HOST_TRIPLE]'
note: sometimes not all components are available in any given nightly
help: if you don't need these components, you could try a minimal installation with:
help: rustup toolchain add nightly --profile minimal
help: rustup toolchain add nightly-[HOST_TRIPLE] --profile minimal
help: if you require these components, please install and use the latest successfully built version,
help: which you can find at <https://rust-lang.github.io/rustup-components-history>
help: after determining the correct date, install it with a command such as:
Expand Down Expand Up @@ -2068,7 +2068,7 @@ async fn update_removed_component_toolchain() {
.await
.with_stderr(snapbox::str![[r#"
...
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'stable'
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'stable-[HOST_TRIPLE]'
One or many components listed above might have been permanently removed from newer versions
of the official Rust distribution due to deprecation.
...
Expand Down Expand Up @@ -2112,7 +2112,7 @@ async fn update_unavailable_force() {
.await
.with_stderr(snapbox::str![[r#"
...
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly-[HOST_TRIPLE]'
...
"#]])
.is_err();
Expand Down Expand Up @@ -2429,7 +2429,7 @@ async fn test_complete_profile_skips_missing_when_forced() {
.await
.with_stderr(snapbox::str![[r#"
...
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly-[HOST_TRIPLE]'
...
"#]])
.is_err();
Expand Down Expand Up @@ -2522,7 +2522,7 @@ async fn install_allow_downgrade() {
.await
.with_stderr(snapbox::str![[r#"
...
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly-[HOST_TRIPLE]'
...
"#]])
.is_err();
Expand Down
Loading