diff --git a/Cargo.lock b/Cargo.lock index 472c84c24..e10ea2a4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2517,70 +2517,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lexical-core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" -dependencies = [ - "lexical-parse-float", - "lexical-parse-integer", - "lexical-util", - "lexical-write-float", - "lexical-write-integer", -] - -[[package]] -name = "lexical-parse-float" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" -dependencies = [ - "lexical-parse-integer", - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-parse-integer" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" -dependencies = [ - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-util" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" -dependencies = [ - "static_assertions", -] - -[[package]] -name = "lexical-write-float" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" -dependencies = [ - "lexical-util", - "lexical-write-integer", - "static_assertions", -] - -[[package]] -name = "lexical-write-integer" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" -dependencies = [ - "lexical-util", - "static_assertions", -] - [[package]] name = "libc" version = "0.2.155" @@ -3999,9 +3935,9 @@ dependencies = [ [[package]] name = "rattler" -version = "0.27.11" +version = "0.27.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d563b8b9551f6adb158e38aa62f46a7dc408221f2de4d542847bc06dd5fc3e" +checksum = "965ab8331a87c11c00d010c8762f0372ca5164fc48f138c65ad91a2623fed8cc" dependencies = [ "anyhow", "clap", @@ -4040,9 +3976,9 @@ dependencies = [ [[package]] name = "rattler_cache" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b54e6fe6f88048c6ef67cef204a82a3352d6a4310c8a99ed6006bdaeeb6606c5" +checksum = "5aa3b9c6437f3eeaca27215f8956afdf69c2a3556c0a47ed5f6c04449ef5f282" dependencies = [ "anyhow", "dashmap", @@ -4068,9 +4004,9 @@ dependencies = [ [[package]] name = "rattler_conda_types" -version = "0.27.6" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be970b4dce3af4eddbae70c91e7d681a47f1165cfc0adc178fab8354027e967" +checksum = "fc4a0774b7af7c35a42faad213808c7c8383fcad01185f990591a2d268c29450" dependencies = [ "chrono", "dirs", @@ -4121,9 +4057,9 @@ dependencies = [ [[package]] name = "rattler_lock" -version = "0.22.24" +version = "0.22.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd53504437d7fb0e2891fe2963fe5ff4c5e3e3447be18daf087567f25e7fb4a" +checksum = "0f5cbd1ccbc81db033d7b97b977f356b72c52fee4c0ad28d71afed0a05a28202" dependencies = [ "chrono", "file_url", @@ -4182,9 +4118,9 @@ dependencies = [ [[package]] name = "rattler_package_streaming" -version = "0.22.7" +version = "0.22.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0295cb7363b926c23faa2fc1c50550e64977b5d9e4567f6b8a4cd4e7b3ed286" +checksum = "538ba45d495642be2bc05531e826171201706def5d867427ae35f3bb45d7ffaf" dependencies = [ "bzip2", "chrono", @@ -4221,9 +4157,9 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" -version = "0.21.13" +version = "0.21.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901b4570a45bca55b94fe7c39d3e772ea373483d284c42381878db03c669c681" +checksum = "d50556663a532a0406e4458bbec71dd96e13a32b2c03a6ac309ad30bf0a44a65" dependencies = [ "anyhow", "async-compression", @@ -4275,9 +4211,9 @@ dependencies = [ [[package]] name = "rattler_shell" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee67c9715c069b28e9c572be381132ee5999207f20e71c62153ad09a1ad79736" +checksum = "5a651a711cac6c0f2351f761603e7ed58d857dafb454f1f5804a4c3faadf58bf" dependencies = [ "enum_dispatch", "indexmap 2.3.0", @@ -4293,9 +4229,9 @@ dependencies = [ [[package]] name = "rattler_solve" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581450cce7f7077e5a5fa17e07889d356ff5eb02f2234a6080ba72dbd5f05bbf" +checksum = "f3db40d5dee6267798c28c32c002fcc1a0a4de7cd6e13b3a70c2193be2656647" dependencies = [ "chrono", "futures", @@ -4312,9 +4248,9 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6d63a2bd6966a6f57739378f6408c67d5c521cf7bbaf6a45071a20595e2991" +checksum = "909854e474213964fac69309e8d7eddd57a5ddebea82c63671218ae2c2cac6d8" dependencies = [ "archspec", "libloading", @@ -5309,13 +5245,12 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "simd-json" -version = "0.13.10" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570c430b3d902ea083097e853263ae782dfe40857d93db019a12356c8e8143fa" +checksum = "05f0b376aada35f30a0012f5790e50aed62f91804a0682669aefdbe81c7fcb91" dependencies = [ "getrandom", "halfbrown", - "lexical-core", "ref-cast", "serde", "serde_json", @@ -6667,9 +6602,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-trait" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad8db98c1e677797df21ba03fca7d3bf9bec3ca38db930954e4fe6e1ea27eb4" +checksum = "bcaa56177466248ba59d693a048c0959ddb67f1151b963f904306312548cf392" dependencies = [ "float-cmp", "halfbrown", diff --git a/Cargo.toml b/Cargo.toml index 97f73a042..717506aea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,16 +89,16 @@ typed-path = "0.9.1" # Rattler crates file_url = "0.1.4" -rattler = { version = "0.27.11", default-features = false } -rattler_cache = { version = "0.2.3", default-features = false } -rattler_conda_types = { version = "0.27.6", default-features = false } +rattler = { version = "0.27.12", default-features = false } +rattler_cache = { version = "0.2.4", default-features = false } +rattler_conda_types = { version = "0.28.0", default-features = false } rattler_digest = { version = "1.0.1", default-features = false } -rattler_lock = { version = "0.22.24", default-features = false } +rattler_lock = { version = "0.22.25", default-features = false } rattler_networking = { version = "0.21.4", default-features = false } -rattler_repodata_gateway = { version = "0.21.13", default-features = false } -rattler_shell = { version = "0.22.1", default-features = false } -rattler_solve = { version = "1.0.7", default-features = false } -rattler_virtual_packages = { version = "1.1.4", default-features = false } +rattler_repodata_gateway = { version = "0.21.14", default-features = false } +rattler_shell = { version = "0.22.2", default-features = false } +rattler_solve = { version = "1.0.8", default-features = false } +rattler_virtual_packages = { version = "1.1.5", default-features = false } # Bumping this to a higher version breaks the Windows path handling. url = "2.5.0" diff --git a/crates/pixi_spec/src/detailed.rs b/crates/pixi_spec/src/detailed.rs index 6ecd39414..34c927d20 100644 --- a/crates/pixi_spec/src/detailed.rs +++ b/crates/pixi_spec/src/detailed.rs @@ -1,8 +1,8 @@ use std::sync::Arc; use rattler_conda_types::{ - BuildNumberSpec, ChannelConfig, NamedChannelOrUrl, NamelessMatchSpec, StringMatcher, - VersionSpec, + BuildNumberSpec, ChannelConfig, NamedChannelOrUrl, NamelessMatchSpec, ParseChannelError, + StringMatcher, VersionSpec, }; use rattler_digest::{Md5Hash, Sha256Hash}; use serde_with::{serde_as, skip_serializing_none}; @@ -48,8 +48,11 @@ pub struct DetailedSpec { impl DetailedSpec { /// Converts this instance into a [`NamelessMatchSpec`]. - pub fn into_nameless_match_spec(self, channel_config: &ChannelConfig) -> NamelessMatchSpec { - NamelessMatchSpec { + pub fn try_into_nameless_match_spec( + self, + channel_config: &ChannelConfig, + ) -> Result { + Ok(NamelessMatchSpec { version: self.version, build: self.build, build_number: self.build_number, @@ -57,12 +60,13 @@ impl DetailedSpec { channel: self .channel .map(|c| c.into_channel(channel_config)) + .transpose()? .map(Arc::new), subdir: self.subdir, namespace: None, md5: self.md5, sha256: self.sha256, url: None, - } + }) } } diff --git a/crates/pixi_spec/src/lib.rs b/crates/pixi_spec/src/lib.rs index e5edfb2ba..f2e8b9298 100644 --- a/crates/pixi_spec/src/lib.rs +++ b/crates/pixi_spec/src/lib.rs @@ -19,7 +19,9 @@ use std::{path::PathBuf, str::FromStr}; pub use detailed::DetailedSpec; pub use git::{GitReference, GitSpec}; pub use path::{PathSourceSpec, PathSpec}; -use rattler_conda_types::{ChannelConfig, NamedChannelOrUrl, NamelessMatchSpec, VersionSpec}; +use rattler_conda_types::{ + ChannelConfig, NamedChannelOrUrl, NamelessMatchSpec, ParseChannelError, VersionSpec, +}; use thiserror::Error; pub use url::{UrlSourceSpec, UrlSpec}; @@ -38,6 +40,10 @@ pub enum SpecConversionError { /// Encountered an invalid path #[error("invalid path '{0}'")] InvalidPath(String), + + /// Encountered an invalid channel url or path + #[error("invalid channel '{0}'")] + InvalidChannel(#[from] ParseChannelError), } /// A package specification for pixi. @@ -236,7 +242,9 @@ impl PixiSpec { version: Some(version), ..NamelessMatchSpec::default() }), - PixiSpec::DetailedVersion(spec) => Some(spec.into_nameless_match_spec(channel_config)), + PixiSpec::DetailedVersion(spec) => { + Some(spec.try_into_nameless_match_spec(channel_config)?) + } PixiSpec::Url(url) => url.try_into_nameless_match_spec().ok(), PixiSpec::Git(_) => None, PixiSpec::Path(path) => path.try_into_nameless_match_spec(&channel_config.root_dir)?, diff --git a/src/cli/cli_config.rs b/src/cli/cli_config.rs index 3ba9f5414..cef75cdaf 100644 --- a/src/cli/cli_config.rs +++ b/src/cli/cli_config.rs @@ -5,6 +5,7 @@ use crate::Project; use clap::Parser; use indexmap::IndexSet; use itertools::Itertools; +use miette::IntoDiagnostic; use pixi_config::{Config, ConfigCli}; use pixi_consts::consts; use pixi_manifest::FeaturesExt; @@ -38,12 +39,15 @@ pub struct ChannelsConfig { impl ChannelsConfig { /// Parses the channels, getting channel config and default channels from config - pub(crate) fn resolve_from_config(&self, config: &Config) -> IndexSet { + pub(crate) fn resolve_from_config(&self, config: &Config) -> miette::Result> { self.resolve(config.global_channel_config(), config.default_channels()) } /// Parses the channels, getting channel config and default channels from project - pub(crate) fn resolve_from_project(&self, project: Option<&Project>) -> IndexSet { + pub(crate) fn resolve_from_project( + &self, + project: Option<&Project>, + ) -> miette::Result> { match project { Some(project) => { let channels = project @@ -63,7 +67,7 @@ impl ChannelsConfig { &self, channel_config: &ChannelConfig, default_channels: Vec, - ) -> IndexSet { + ) -> miette::Result> { let channels = if self.channels.is_empty() { default_channels } else { @@ -72,7 +76,8 @@ impl ChannelsConfig { channels .into_iter() .map(|c| c.into_channel(channel_config)) - .collect() + .try_collect() + .into_diagnostic() } } diff --git a/src/cli/exec.rs b/src/cli/exec.rs index 34156845d..645502d2a 100644 --- a/src/cli/exec.rs +++ b/src/cli/exec.rs @@ -55,8 +55,8 @@ pub struct EnvironmentHash { } impl EnvironmentHash { - pub(crate) fn from_args(args: &Args, config: &Config) -> Self { - Self { + pub(crate) fn from_args(args: &Args, config: &Config) -> miette::Result { + Ok(Self { command: args .command .first() @@ -65,11 +65,11 @@ impl EnvironmentHash { specs: args.specs.clone(), channels: args .channels - .resolve_from_config(config) + .resolve_from_config(config)? .iter() .map(|c| c.base_url().to_string()) .collect(), - } + }) } /// Returns the name of the environment. @@ -118,7 +118,7 @@ pub async fn create_exec_prefix( config: &Config, client: &ClientWithMiddleware, ) -> miette::Result { - let environment_name = EnvironmentHash::from_args(args, config).name(); + let environment_name = EnvironmentHash::from_args(args, config)?.name(); let prefix = Prefix::new( cache_dir .join(pixi_consts::consts::CACHED_ENVS_DIR) @@ -168,11 +168,13 @@ pub async fn create_exec_prefix( args.specs.clone() }; + let channels = args.channels.resolve_from_config(config)?; + // Get the repodata for the specs let repodata = await_in_progress("fetching repodata for environment", |_| async { gateway .query( - args.channels.resolve_from_config(config), + channels, [Platform::current(), Platform::NoArch], specs.clone(), ) diff --git a/src/cli/global/install.rs b/src/cli/global/install.rs index fde4625e0..d1508592d 100644 --- a/src/cli/global/install.rs +++ b/src/cli/global/install.rs @@ -303,7 +303,7 @@ pub(crate) fn prompt_user_to_continue( pub async fn execute(args: Args) -> miette::Result<()> { // Figure out what channels we are using let config = Config::with_cli_config(&args.config); - let channels = args.channels.resolve_from_config(&config); + let channels = args.channels.resolve_from_config(&config)?; let specs = args.specs()?; diff --git a/src/cli/global/upgrade.rs b/src/cli/global/upgrade.rs index 7c6c64c2a..8177bbcba 100644 --- a/src/cli/global/upgrade.rs +++ b/src/cli/global/upgrade.rs @@ -50,7 +50,7 @@ pub(super) async fn upgrade_packages( cli_channels: ChannelsConfig, platform: Platform, ) -> miette::Result<()> { - let channel_cli = cli_channels.resolve_from_config(&config); + let channel_cli = cli_channels.resolve_from_config(&config)?; // Get channels and version of globally installed packages in parallel let mut channels = HashMap::with_capacity(specs.len()); diff --git a/src/cli/project/channel/add.rs b/src/cli/project/channel/add.rs index d90a1e8ce..98735edc3 100644 --- a/src/cli/project/channel/add.rs +++ b/src/cli/project/channel/add.rs @@ -21,7 +21,7 @@ pub async fn execute(mut project: Project, args: AddRemoveArgs) -> miette::Resul project.save()?; // Report back to the user - args.report("Added", &project.channel_config()); + args.report("Added", &project.channel_config())?; Ok(()) } diff --git a/src/cli/project/channel/list.rs b/src/cli/project/channel/list.rs index 848353c9d..94a1c764b 100644 --- a/src/cli/project/channel/list.rs +++ b/src/cli/project/channel/list.rs @@ -1,4 +1,5 @@ use clap::Parser; +use miette::IntoDiagnostic; use crate::Project; use fancy_display::FancyDisplay; @@ -24,17 +25,24 @@ pub(crate) fn execute(project: Project, args: Args) -> miette::Result<()> { ); e.channels() }) - .for_each(|c| { - c.into_iter().for_each(|channel| { - println!( - "- {}", - if args.urls { - channel.clone().into_base_url(&channel_config).to_string() - } else { - channel.to_string() - } - ); - }) - }); + .try_for_each(|c| -> Result<(), rattler_conda_types::ParseChannelError> { + c.into_iter().try_for_each( + |channel| -> Result<(), rattler_conda_types::ParseChannelError> { + println!( + "- {}", + if args.urls { + match channel.clone().into_base_url(&channel_config) { + Ok(url) => url.to_string(), + Err(e) => return Err(e), + } + } else { + channel.to_string() + } + ); + Ok(()) + }, + ) + }) + .into_diagnostic()?; Ok(()) } diff --git a/src/cli/project/channel/mod.rs b/src/cli/project/channel/mod.rs index bc123b929..418544a0f 100644 --- a/src/cli/project/channel/mod.rs +++ b/src/cli/project/channel/mod.rs @@ -4,6 +4,7 @@ pub mod remove; use crate::Project; use clap::Parser; +use miette::IntoDiagnostic; use pixi_manifest::{FeatureName, PrioritizedChannel}; use rattler_conda_types::{ChannelConfig, NamedChannelOrUrl}; use std::path::PathBuf; @@ -54,14 +55,17 @@ impl AddRemoveArgs { .map_or(FeatureName::Default, FeatureName::Named) } - fn report(self, operation: &str, channel_config: &ChannelConfig) { + fn report(self, operation: &str, channel_config: &ChannelConfig) -> miette::Result<()> { for channel in self.channel { match channel { NamedChannelOrUrl::Name(ref name) => eprintln!( "{}{operation} {} ({}){}", console::style(console::Emoji("✔ ", "")).green(), name, - channel.clone().into_base_url(channel_config), + channel + .clone() + .into_base_url(channel_config) + .into_diagnostic()?, self.priority .map_or_else(|| "".to_string(), |p| format!(" at priority {}", p)) ), @@ -72,8 +76,14 @@ impl AddRemoveArgs { self.priority .map_or_else(|| "".to_string(), |p| format!(" at priority {}", p)), ), + NamedChannelOrUrl::Path(path) => eprintln!( + "{}{operation} {}", + console::style(console::Emoji("✔ ", "")).green(), + path + ), } } + Ok(()) } } diff --git a/src/cli/project/channel/remove.rs b/src/cli/project/channel/remove.rs index 890991710..b93b773f2 100644 --- a/src/cli/project/channel/remove.rs +++ b/src/cli/project/channel/remove.rs @@ -21,7 +21,7 @@ pub async fn execute(mut project: Project, args: AddRemoveArgs) -> miette::Resul project.save()?; // Report back to the user - args.report("Removed", &project.channel_config()); + args.report("Removed", &project.channel_config())?; Ok(()) } diff --git a/src/cli/search.rs b/src/cli/search.rs index d5d9aaeb8..ea882b906 100644 --- a/src/cli/search.rs +++ b/src/cli/search.rs @@ -102,7 +102,7 @@ pub async fn execute(args: Args) -> miette::Result<()> { let project = Project::load_or_else_discover(args.project_config.manifest_path.as_deref()).ok(); // Resolve channels from project / CLI args - let channels = args.channels.resolve_from_project(project.as_ref()); + let channels = args.channels.resolve_from_project(project.as_ref())?; eprintln!( "Using channels: {}", channels.iter().map(|c| c.name()).format(", ") diff --git a/src/lock_file/outdated.rs b/src/lock_file/outdated.rs index 5f16b325d..41d91e9c1 100644 --- a/src/lock_file/outdated.rs +++ b/src/lock_file/outdated.rs @@ -159,7 +159,7 @@ fn find_unsatisfiable_targets<'p>( .extend(platforms); match unsat { - EnvironmentUnsat::ChannelsMismatch => { + EnvironmentUnsat::ChannelsMismatch | EnvironmentUnsat::InvalidChannel(_) => { // If the channels mismatched we also cannot trust any of the locked content. disregard_locked_content.conda.insert(environment.clone()); } diff --git a/src/lock_file/satisfiability.rs b/src/lock_file/satisfiability.rs index 3914ad51b..f015457ad 100644 --- a/src/lock_file/satisfiability.rs +++ b/src/lock_file/satisfiability.rs @@ -41,6 +41,9 @@ pub enum EnvironmentUnsat { #[error(transparent)] IndexesMismatch(#[from] IndexesMismatch), + + #[error(transparent)] + InvalidChannel(#[from] ParseChannelError), } #[derive(Debug, Error)] @@ -243,18 +246,28 @@ pub fn verify_environment_satisfiability( // that the order matters here. If channels are added in a different order, // the solver might return a different result. let config = environment.project().channel_config(); - let channels = grouped_env + let channels: Vec = grouped_env .channels() .into_iter() - .map(|channel| channel.clone().into_channel(&config).base_url().clone()); - let locked_channels = locked_environment.channels().iter().map(|c| { - NamedChannelOrUrl::from_str(&c.url) - .unwrap_or_else(|_err| NamedChannelOrUrl::Name(c.url.clone())) - .into_channel(&config) - .base_url() - .clone() - }); - if !channels.eq(locked_channels) { + .map(|channel| { + channel + .clone() + .into_channel(&config) + .map(|channel| channel.base_url().clone()) + }) + .try_collect()?; + + let locked_channels: Vec = locked_environment + .channels() + .iter() + .map(|c| { + NamedChannelOrUrl::from_str(&c.url) + .unwrap_or_else(|_err| NamedChannelOrUrl::Name(c.url.clone())) + .into_channel(&config) + .map(|channel| channel.base_url().clone()) + }) + .try_collect()?; + if !channels.eq(&locked_channels) { return Err(EnvironmentUnsat::ChannelsMismatch); } @@ -640,6 +653,7 @@ pub(crate) fn verify_package_platform_satisfiability( SpecConversionError::InvalidPath(p) => { ParseChannelError::InvalidPath(p).into() } + SpecConversionError::InvalidChannel(c) => c.into(), }; return Err(PlatformUnsat::FailedToParseMatchSpec( name.as_source().to_string(), diff --git a/src/lock_file/update.rs b/src/lock_file/update.rs index 4bf45e979..49c2ae9e1 100644 --- a/src/lock_file/update.rs +++ b/src/lock_file/update.rs @@ -26,7 +26,7 @@ use pixi_progress::global_multi_progress; use pypi_mapping::{self, Reporter}; use pypi_modifiers::{pypi_marker_env::determine_marker_environment, pypi_tags::is_python_record}; use rattler::package_cache::PackageCache; -use rattler_conda_types::{Arch, MatchSpec, Platform, RepoDataRecord}; +use rattler_conda_types::{Arch, Channel, MatchSpec, Platform, RepoDataRecord}; use rattler_lock::{LockFile, PypiIndexes, PypiPackageData, PypiPackageEnvironmentData}; use rattler_repodata_gateway::{Gateway, RepoData}; use rattler_solve::ChannelPriority; @@ -1342,14 +1342,19 @@ impl<'p> UpdateContext<'p> { let grouped_env = GroupedEnvironment::from(environment.clone()); let channel_config = project.channel_config(); - builder.set_channels( - &environment_name, - grouped_env - .channels() - .into_iter() - .cloned() - .map(|channel| channel.into_base_url(&channel_config).to_string()), - ); + let channels: Vec = grouped_env + .channels() + .into_iter() + .cloned() + .map(|channel| { + channel + .into_base_url(&channel_config) + .map(|ch| ch.to_string()) + }) + .try_collect() + .into_diagnostic()?; + + builder.set_channels(&environment_name, channels); let mut has_pypi_records = false; for platform in environment.platforms() { @@ -1547,14 +1552,14 @@ async fn spawn_solve_conda_environment_task( // Extract the repo data records needed to solve the environment. pb.set_message("loading repodata"); let fetch_repodata_start = Instant::now(); + let channels: Vec = channels + .into_iter() + .map(|c| c.into_channel(&channel_config)) + .try_collect() + .into_diagnostic()?; + let available_packages = repodata_gateway - .query( - channels - .into_iter() - .map(|c| c.into_channel(&channel_config)), - [platform, Platform::NoArch], - match_specs.clone(), - ) + .query(channels, [platform, Platform::NoArch], match_specs.clone()) .recursive(true) .with_reporter(GatewayProgressReporter::new(pb.clone())) .await diff --git a/src/project/mod.rs b/src/project/mod.rs index d04208e25..ccc8bac59 100644 --- a/src/project/mod.rs +++ b/src/project/mod.rs @@ -518,7 +518,7 @@ impl Project { let channel_to_location_map = map .into_iter() .map(|(key, value)| { - let key = key.into_channel(channel_config); + let key = key.into_channel(channel_config).into_diagnostic()?; Ok((key, value)) }) .collect::>>()?; @@ -534,7 +534,8 @@ impl Project { .channels .iter() .map(|pc| pc.channel.clone().into_channel(channel_config)) - .collect(); + .try_collect() + .into_diagnostic()?; let feature_channels: HashSet<_> = manifest .parsed @@ -543,7 +544,8 @@ impl Project { .flat_map(|feature| feature.channels.iter()) .flatten() .map(|pc| pc.channel.clone().into_channel(channel_config)) - .collect(); + .try_collect() + .into_diagnostic()?; let project_and_feature_channels: HashSet<_> = project_channels.union(&feature_channels).collect();