From 93829041f7171284f29e7f1cce3a2cff812d3671 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Tue, 12 Dec 2023 15:47:27 +0100 Subject: [PATCH 01/15] add option to force usage of fallback_auth --- Cargo.lock | 10 ---------- Cargo.toml | 36 ++++++++++++++++++------------------ src/build.rs | 1 + src/main.rs | 47 +++++++++++++++++++++++++++++++++++++++++++++-- src/test.rs | 15 +++------------ 5 files changed, 67 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1d4eef48..1a7cae7d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2475,7 +2475,6 @@ dependencies = [ [[package]] name = "rattler" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "anyhow", "async-compression", @@ -2577,7 +2576,6 @@ dependencies = [ [[package]] name = "rattler_conda_types" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "chrono", "fxhash", @@ -2606,7 +2604,6 @@ dependencies = [ [[package]] name = "rattler_digest" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "blake2", "digest", @@ -2621,7 +2618,6 @@ dependencies = [ [[package]] name = "rattler_macros" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "quote", "syn 2.0.39", @@ -2630,7 +2626,6 @@ dependencies = [ [[package]] name = "rattler_networking" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "anyhow", "dirs", @@ -2653,7 +2648,6 @@ dependencies = [ [[package]] name = "rattler_package_streaming" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "bzip2", "chrono", @@ -2676,7 +2670,6 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "anyhow", "async-compression", @@ -2714,7 +2707,6 @@ dependencies = [ [[package]] name = "rattler_shell" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "enum_dispatch", "indexmap 2.1.0", @@ -2731,7 +2723,6 @@ dependencies = [ [[package]] name = "rattler_solve" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "anyhow", "chrono", @@ -2750,7 +2741,6 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#bd5cb2c6eb9344f1d3fbe4fe75d547add92629d4" dependencies = [ "cfg-if", "libloading", diff --git a/Cargo.toml b/Cargo.toml index 4a0c74128..7d37e2249 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,22 +100,22 @@ pre-build = [ ] [patch.crates-io] -rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } +# rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler = { path = "../rattler/crates/rattler" } -# rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" } -# rattler_digest = { path = "../rattler/crates/rattler_digest" } -# rattler_networking = { path = "../rattler/crates/rattler_networking" } -# rattler_repodata_gateway = { path = "../rattler/crates/rattler_repodata_gateway" } -# rattler_shell = { path = "../rattler/crates/rattler_shell" } -# rattler_solve = { path = "../rattler/crates/rattler_solve" } -# rattler_virtual_packages = { path = "../rattler/crates/rattler_virtual_packages" } -# rattler_package_streaming = { path = "../rattler/crates/rattler_package_streaming" } +rattler = { path = "../rattler/crates/rattler" } +rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" } +rattler_digest = { path = "../rattler/crates/rattler_digest" } +rattler_networking = { path = "../rattler/crates/rattler_networking" } +rattler_repodata_gateway = { path = "../rattler/crates/rattler_repodata_gateway" } +rattler_shell = { path = "../rattler/crates/rattler_shell" } +rattler_solve = { path = "../rattler/crates/rattler_solve" } +rattler_virtual_packages = { path = "../rattler/crates/rattler_virtual_packages" } +rattler_package_streaming = { path = "../rattler/crates/rattler_package_streaming" } diff --git a/src/build.rs b/src/build.rs index 71ba42347..3ac26c7ba 100644 --- a/src/build.rs +++ b/src/build.rs @@ -341,6 +341,7 @@ pub async fn run_build( keep_test_prefix: tool_configuration.no_clean, channels, }, + &tool_configuration, ) .await .into_diagnostic()?; diff --git a/src/main.rs b/src/main.rs index f343d5fec..97770f120 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,6 +80,15 @@ struct CommonOpts { /// Enable support for repodata.json.bz2 #[clap(long, env = "RATTLER_BZ2", default_value = "true", hide = true)] use_bz2: bool, + + /// Force usage of the fallback key storage and disable usage of the system keyring + #[clap( + long, + env = "RATTLER_FORCE_FALLBACK_AUTH", + default_value = "false", + hide = true + )] + force_fallback_auth: bool, } #[derive(Parser)] @@ -139,6 +148,9 @@ struct TestOpts { /// The package file to test #[arg(short, long)] package_file: PathBuf, + + #[clap(flatten)] + common: CommonOpts, } #[derive(Parser)] @@ -190,7 +202,26 @@ async fn run_test_from_args(args: TestOpts) -> miette::Result<()> { channels: vec!["conda-forge".to_string(), "./output".to_string()], }; - test::run_test(&package_file, &test_options) + let mut auth_store = rattler_networking::AuthenticationStorage::default(); + + auth_store.set_force_fallback_storage(args.common.force_fallback_auth); + + let client = AuthenticatedClient::from_client( + reqwest::Client::builder() + .no_gzip() + .build() + .expect("failed to create client"), + auth_store, + ); + + let global_configuration = tool_configuration::Configuration { + client, + multi_progress_indicator: MultiProgress::new(), + no_clean: test_options.keep_test_prefix, + ..Default::default() + }; + + test::run_test(&package_file, &test_options, &global_configuration) .await .into_diagnostic()?; @@ -293,8 +324,20 @@ async fn run_build_from_args(args: BuildOpts, multi_progress: MultiProgress) -> tracing::info!("{}\n", table); } + let mut auth_store = rattler_networking::AuthenticationStorage::default(); + + auth_store.set_force_fallback_storage(args.common.force_fallback_auth); + + let client = AuthenticatedClient::from_client( + reqwest::Client::builder() + .no_gzip() + .build() + .expect("failed to create client"), + auth_store, + ); + let tool_config = tool_configuration::Configuration { - client: AuthenticatedClient::default(), + client, multi_progress_indicator: multi_progress, no_clean: args.keep_build, no_test: args.no_test, diff --git a/src/test.rs b/src/test.rs index 0df047c81..14ba3caa2 100644 --- a/src/test.rs +++ b/src/test.rs @@ -15,19 +15,17 @@ use std::{ }; use dunce::canonicalize; -use indicatif::MultiProgress; use rattler::package_cache::CacheKey; use rattler_conda_types::{ package::{ArchiveIdentifier, ArchiveType, PathsJson}, MatchSpec, Platform, }; -use rattler_networking::AuthenticatedClient; use rattler_shell::{ activation::{ActivationError, ActivationVariables, Activator}, shell::{Shell, ShellEnum, ShellScript}, }; -use crate::{env_vars, index, render::solver::create_environment, tool_configuration}; +use crate::{env_vars, index, render::solver::create_environment, tool_configuration::Configuration}; #[allow(missing_docs)] #[derive(thiserror::Error, Debug)] @@ -290,7 +288,7 @@ pub struct TestConfiguration { /// /// * `Ok(())` if the test was successful /// * `Err(TestError::TestFailed)` if the test failed -pub async fn run_test(package_file: &Path, config: &TestConfiguration) -> Result<(), TestError> { +pub async fn run_test(package_file: &Path, config: &TestConfiguration, global_configuration: &Configuration) -> Result<(), TestError> { let tmp_repo = tempfile::tempdir()?; let target_platform = config.target_platform.unwrap_or_else(Platform::current); @@ -354,13 +352,6 @@ pub async fn run_test(package_file: &Path, config: &TestConfiguration) -> Result let prefix = canonicalize(&config.test_prefix)?; - let global_configuration = tool_configuration::Configuration { - client: AuthenticatedClient::default(), - multi_progress_indicator: MultiProgress::new(), - no_clean: config.keep_test_prefix, - ..Default::default() - }; - tracing::info!("Creating test environment in {:?}", prefix); let platform = if target_platform != Platform::NoArch { @@ -374,7 +365,7 @@ pub async fn run_test(package_file: &Path, config: &TestConfiguration) -> Result &platform, &prefix, &config.channels, - &global_configuration, + global_configuration, ) .await .map_err(TestError::TestEnvironmentSetup)?; From 43e1e3509ce940e71c3f43487d9e1b48f2c1f08a Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Tue, 12 Dec 2023 15:50:27 +0100 Subject: [PATCH 02/15] use remote rattler --- Cargo.lock | 10 ++++++++++ Cargo.toml | 36 ++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a7cae7d6..d26bc13a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2475,6 +2475,7 @@ dependencies = [ [[package]] name = "rattler" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "anyhow", "async-compression", @@ -2576,6 +2577,7 @@ dependencies = [ [[package]] name = "rattler_conda_types" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "chrono", "fxhash", @@ -2604,6 +2606,7 @@ dependencies = [ [[package]] name = "rattler_digest" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "blake2", "digest", @@ -2618,6 +2621,7 @@ dependencies = [ [[package]] name = "rattler_macros" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "quote", "syn 2.0.39", @@ -2626,6 +2630,7 @@ dependencies = [ [[package]] name = "rattler_networking" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "anyhow", "dirs", @@ -2648,6 +2653,7 @@ dependencies = [ [[package]] name = "rattler_package_streaming" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "bzip2", "chrono", @@ -2670,6 +2676,7 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "anyhow", "async-compression", @@ -2707,6 +2714,7 @@ dependencies = [ [[package]] name = "rattler_shell" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "enum_dispatch", "indexmap 2.1.0", @@ -2723,6 +2731,7 @@ dependencies = [ [[package]] name = "rattler_solve" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "anyhow", "chrono", @@ -2741,6 +2750,7 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" version = "0.14.0" +source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" dependencies = [ "cfg-if", "libloading", diff --git a/Cargo.toml b/Cargo.toml index 7d37e2249..4a0c74128 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,22 +100,22 @@ pre-build = [ ] [patch.crates-io] -# rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" } -rattler = { path = "../rattler/crates/rattler" } -rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" } -rattler_digest = { path = "../rattler/crates/rattler_digest" } -rattler_networking = { path = "../rattler/crates/rattler_networking" } -rattler_repodata_gateway = { path = "../rattler/crates/rattler_repodata_gateway" } -rattler_shell = { path = "../rattler/crates/rattler_shell" } -rattler_solve = { path = "../rattler/crates/rattler_solve" } -rattler_virtual_packages = { path = "../rattler/crates/rattler_virtual_packages" } -rattler_package_streaming = { path = "../rattler/crates/rattler_package_streaming" } +# rattler = { path = "../rattler/crates/rattler" } +# rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" } +# rattler_digest = { path = "../rattler/crates/rattler_digest" } +# rattler_networking = { path = "../rattler/crates/rattler_networking" } +# rattler_repodata_gateway = { path = "../rattler/crates/rattler_repodata_gateway" } +# rattler_shell = { path = "../rattler/crates/rattler_shell" } +# rattler_solve = { path = "../rattler/crates/rattler_solve" } +# rattler_virtual_packages = { path = "../rattler/crates/rattler_virtual_packages" } +# rattler_package_streaming = { path = "../rattler/crates/rattler_package_streaming" } From 4db86fccb16f935a0be4990ffcc8acb68dc16245 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Wed, 13 Dec 2023 08:57:06 +0100 Subject: [PATCH 03/15] adapt to new storage backends --- src/main.rs | 30 +++++++++++++++++------------- src/tool_configuration.rs | 7 +------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/main.rs b/src/main.rs index 97770f120..93c8ca4fc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,14 +81,14 @@ struct CommonOpts { #[clap(long, env = "RATTLER_BZ2", default_value = "true", hide = true)] use_bz2: bool, - /// Force usage of the fallback key storage and disable usage of the system keyring + /// Force usage of the file based authentication storage #[clap( long, - env = "RATTLER_FORCE_FALLBACK_AUTH", + env = "RATTLER_USE_AUTH_FILE", default_value = "false", hide = true )] - force_fallback_auth: bool, + use_auth_file: bool, } #[derive(Parser)] @@ -190,6 +190,18 @@ async fn main() -> miette::Result<()> { } } +fn get_auth_store(use_auth_file: bool) -> rattler_networking::AuthenticationStorage { + if use_auth_file { + let mut store = rattler_networking::AuthenticationStorage::new(); + store.add_backend(Box::from( + rattler_networking::authentication_storage::backends::file::FileStorage::default(), + )); + store + } else { + rattler_networking::AuthenticationStorage::default() + } +} + async fn run_test_from_args(args: TestOpts) -> miette::Result<()> { let package_file = canonicalize(args.package_file).into_diagnostic()?; let test_prefix = PathBuf::from("test-prefix"); @@ -202,16 +214,12 @@ async fn run_test_from_args(args: TestOpts) -> miette::Result<()> { channels: vec!["conda-forge".to_string(), "./output".to_string()], }; - let mut auth_store = rattler_networking::AuthenticationStorage::default(); - - auth_store.set_force_fallback_storage(args.common.force_fallback_auth); - let client = AuthenticatedClient::from_client( reqwest::Client::builder() .no_gzip() .build() .expect("failed to create client"), - auth_store, + get_auth_store(args.common.use_auth_file), ); let global_configuration = tool_configuration::Configuration { @@ -324,16 +332,12 @@ async fn run_build_from_args(args: BuildOpts, multi_progress: MultiProgress) -> tracing::info!("{}\n", table); } - let mut auth_store = rattler_networking::AuthenticationStorage::default(); - - auth_store.set_force_fallback_storage(args.common.force_fallback_auth); - let client = AuthenticatedClient::from_client( reqwest::Client::builder() .no_gzip() .build() .expect("failed to create client"), - auth_store, + get_auth_store(args.common.use_auth_file), ); let tool_config = tool_configuration::Configuration { diff --git a/src/tool_configuration.rs b/src/tool_configuration.rs index f6de879f6..ed4ed5f5f 100644 --- a/src/tool_configuration.rs +++ b/src/tool_configuration.rs @@ -1,8 +1,6 @@ //! Configuration for the rattler-build tool //! This is useful when using rattler-build as a library -use std::path::PathBuf; - use rattler_networking::AuthenticatedClient; /// Global configuration for the build @@ -36,10 +34,7 @@ impl Default for Configuration { .no_gzip() .build() .expect("failed to create client"), - rattler_networking::AuthenticationStorage::new( - "rattler", - &PathBuf::from("~/.rattler"), - ), + rattler_networking::AuthenticationStorage::default(), ), no_clean: false, no_test: false, From eea39ab40768846a8657397b7549fef55828dbb0 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Fri, 15 Dec 2023 10:55:04 +0100 Subject: [PATCH 04/15] use user-provided --auth-file --- Cargo.lock | 194 ++++++++++++++++++++++++++-------------------------- src/main.rs | 35 +++++----- 2 files changed, 117 insertions(+), 112 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d26bc13a5..861d7ee76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,9 +61,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a318f1f38d2418400f8209655bfd825785afd25aa30bb7ba6cc792e4596748" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ "windows-sys 0.52.0", ] @@ -206,9 +206,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" +checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" dependencies = [ "async-lock 3.2.0", "cfg-if", @@ -217,7 +217,7 @@ dependencies = [ "futures-lite 2.1.0", "parking", "polling 3.3.1", - "rustix 0.38.26", + "rustix 0.38.28", "slab", "tracing", "windows-sys 0.52.0", @@ -256,7 +256,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.26", + "rustix 0.38.28", "windows-sys 0.48.0", ] @@ -268,7 +268,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -277,13 +277,13 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.2.1", + "async-io 2.2.2", "async-lock 2.8.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.26", + "rustix 0.38.28", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -303,7 +303,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -570,7 +570,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -664,9 +664,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -675,22 +675,21 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset 0.9.0", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if", ] @@ -748,7 +747,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -759,7 +758,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -866,7 +865,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -887,7 +886,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -1138,7 +1137,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -1299,9 +1298,9 @@ dependencies = [ [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] @@ -1337,9 +1336,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes 1.5.0", "http", @@ -1571,7 +1570,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.26", + "rustix 0.38.28", "windows-sys 0.48.0", ] @@ -1601,9 +1600,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" @@ -1669,7 +1668,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -1680,9 +1679,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libloading" @@ -1855,7 +1854,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -1891,9 +1890,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", @@ -2062,9 +2061,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" @@ -2095,7 +2094,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -2153,7 +2152,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -2249,7 +2248,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", "unicase", ] @@ -2337,16 +2336,16 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.26", + "rustix 0.38.28", "tracing", "windows-sys 0.52.0", ] [[package]] name = "portable-atomic" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" [[package]] name = "powerfmt" @@ -2475,7 +2474,7 @@ dependencies = [ [[package]] name = "rattler" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "anyhow", "async-compression", @@ -2577,7 +2576,7 @@ dependencies = [ [[package]] name = "rattler_conda_types" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "chrono", "fxhash", @@ -2606,7 +2605,7 @@ dependencies = [ [[package]] name = "rattler_digest" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "blake2", "digest", @@ -2621,16 +2620,16 @@ dependencies = [ [[package]] name = "rattler_macros" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] name = "rattler_networking" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "anyhow", "dirs", @@ -2653,7 +2652,7 @@ dependencies = [ [[package]] name = "rattler_package_streaming" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "bzip2", "chrono", @@ -2676,7 +2675,7 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "anyhow", "async-compression", @@ -2714,7 +2713,7 @@ dependencies = [ [[package]] name = "rattler_shell" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "enum_dispatch", "indexmap 2.1.0", @@ -2731,7 +2730,7 @@ dependencies = [ [[package]] name = "rattler_solve" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "anyhow", "chrono", @@ -2750,7 +2749,7 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" version = "0.14.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#66cad536862c28bae09f80efd8fe29442822194b" +source = "git+https://github.com/mamba-org/rattler?branch=main#8948ec7b2669604dcc402062bf528790df2665b6" dependencies = [ "cfg-if", "libloading", @@ -2926,9 +2925,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.6" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", @@ -2963,7 +2962,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.39", + "syn 2.0.41", "unicode-ident", ] @@ -3009,9 +3008,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.26" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ "bitflags 2.4.1", "errno", @@ -3022,9 +3021,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.9" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring", @@ -3059,9 +3058,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "safemem" @@ -3110,7 +3109,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3188,7 +3187,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3211,7 +3210,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3252,7 +3251,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3433,7 +3432,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3489,9 +3488,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" dependencies = [ "proc-macro2", "quote", @@ -3560,7 +3559,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall", - "rustix 0.38.26", + "rustix 0.38.28", "windows-sys 0.48.0", ] @@ -3602,7 +3601,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3661,9 +3660,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" dependencies = [ "backtrace", "bytes 1.5.0", @@ -3695,7 +3694,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3785,7 +3784,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3800,9 +3799,9 @@ dependencies = [ [[package]] name = "tracing-indicatif" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e05fe4a1c906d94b275d8aeb8ff8b9deaca502aeb59ae8ab500a92b8032ac8" +checksum = "069580424efe11d97c3fef4197fa98c004fa26672cc71ad8770d224e23b1951d" dependencies = [ "indicatif", "tracing", @@ -3873,9 +3872,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" @@ -3885,10 +3884,11 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uds_windows" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" +checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ + "memoffset 0.9.0", "tempfile", "winapi", ] @@ -3904,9 +3904,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -3937,9 +3937,9 @@ checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unsafe-libyaml" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" +checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" [[package]] name = "untrusted" @@ -4078,7 +4078,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", "wasm-bindgen-shared", ] @@ -4112,7 +4112,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4161,7 +4161,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.26", + "rustix 0.38.28", "windows-sys 0.48.0", ] @@ -4405,9 +4405,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.24" +version = "0.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0383266b19108dfc6314a56047aa545a1b4d1be60e799b4dbdd407b56402704b" +checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" dependencies = [ "memchr", ] @@ -4433,11 +4433,13 @@ dependencies = [ [[package]] name = "xattr" -version = "1.0.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +checksum = "a7dae5072fe1f8db8f8d29059189ac175196e410e40ba42d5d4684ae2f750995" dependencies = [ "libc", + "linux-raw-sys 0.4.12", + "rustix 0.38.28", ] [[package]] diff --git a/src/main.rs b/src/main.rs index 93c8ca4fc..204e05e52 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use std::{ collections::BTreeMap, env::current_dir, path::PathBuf, - str::{self, FromStr}, + str::{self, FromStr}, sync::Arc, }; use tracing_subscriber::{ filter::{Directive, ParseError}, @@ -81,14 +81,14 @@ struct CommonOpts { #[clap(long, env = "RATTLER_BZ2", default_value = "true", hide = true)] use_bz2: bool, - /// Force usage of the file based authentication storage + /// Use a auth file for storing authentication information #[clap( long, - env = "RATTLER_USE_AUTH_FILE", - default_value = "false", + env = "RATTLER_AUTH_FILE", + default_value = "None", hide = true )] - use_auth_file: bool, + auth_file: Option, } #[derive(Parser)] @@ -190,15 +190,18 @@ async fn main() -> miette::Result<()> { } } -fn get_auth_store(use_auth_file: bool) -> rattler_networking::AuthenticationStorage { - if use_auth_file { - let mut store = rattler_networking::AuthenticationStorage::new(); - store.add_backend(Box::from( - rattler_networking::authentication_storage::backends::file::FileStorage::default(), - )); - store - } else { - rattler_networking::AuthenticationStorage::default() +fn get_auth_store(auth_file: Option) -> rattler_networking::AuthenticationStorage { + match auth_file { + Some(auth_file) => { + let mut store = rattler_networking::AuthenticationStorage::new(); + store.add_backend(Arc::from( + rattler_networking::authentication_storage::backends::file::FileStorage::new( + auth_file, + ), + )); + store + } + None => rattler_networking::AuthenticationStorage::default(), } } @@ -219,7 +222,7 @@ async fn run_test_from_args(args: TestOpts) -> miette::Result<()> { .no_gzip() .build() .expect("failed to create client"), - get_auth_store(args.common.use_auth_file), + get_auth_store(args.common.auth_file), ); let global_configuration = tool_configuration::Configuration { @@ -337,7 +340,7 @@ async fn run_build_from_args(args: BuildOpts, multi_progress: MultiProgress) -> .no_gzip() .build() .expect("failed to create client"), - get_auth_store(args.common.use_auth_file), + get_auth_store(args.common.auth_file), ); let tool_config = tool_configuration::Configuration { From 97b3389986f38debc4f45102fd26d7602512456f Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Fri, 15 Dec 2023 10:59:04 +0100 Subject: [PATCH 05/15] update docs --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 204e05e52..2d553784a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,7 @@ struct CommonOpts { #[clap(long, env = "RATTLER_BZ2", default_value = "true", hide = true)] use_bz2: bool, - /// Use a auth file for storing authentication information + /// Path to an auth-file to read authentication information from #[clap( long, env = "RATTLER_AUTH_FILE", From 8c8021c3a2ce90b11b3d0f52dcf5c12c3a2a5d58 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Fri, 15 Dec 2023 11:13:26 +0100 Subject: [PATCH 06/15] fmt --- src/main.rs | 10 +++------- src/test.rs | 10 ++++++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2d553784a..1644ef168 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,8 @@ use std::{ collections::BTreeMap, env::current_dir, path::PathBuf, - str::{self, FromStr}, sync::Arc, + str::{self, FromStr}, + sync::Arc, }; use tracing_subscriber::{ filter::{Directive, ParseError}, @@ -82,12 +83,7 @@ struct CommonOpts { use_bz2: bool, /// Path to an auth-file to read authentication information from - #[clap( - long, - env = "RATTLER_AUTH_FILE", - default_value = "None", - hide = true - )] + #[clap(long, env = "RATTLER_AUTH_FILE", default_value = "None", hide = true)] auth_file: Option, } diff --git a/src/test.rs b/src/test.rs index 14ba3caa2..30befab44 100644 --- a/src/test.rs +++ b/src/test.rs @@ -25,7 +25,9 @@ use rattler_shell::{ shell::{Shell, ShellEnum, ShellScript}, }; -use crate::{env_vars, index, render::solver::create_environment, tool_configuration::Configuration}; +use crate::{ + env_vars, index, render::solver::create_environment, tool_configuration::Configuration, +}; #[allow(missing_docs)] #[derive(thiserror::Error, Debug)] @@ -288,7 +290,11 @@ pub struct TestConfiguration { /// /// * `Ok(())` if the test was successful /// * `Err(TestError::TestFailed)` if the test failed -pub async fn run_test(package_file: &Path, config: &TestConfiguration, global_configuration: &Configuration) -> Result<(), TestError> { +pub async fn run_test( + package_file: &Path, + config: &TestConfiguration, + global_configuration: &Configuration, +) -> Result<(), TestError> { let tmp_repo = tempfile::tempdir()?; let target_platform = config.target_platform.unwrap_or_else(Platform::current); From 9032ce1549aacb058b390e3cd87e81b2ded590b3 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sat, 16 Dec 2023 21:33:26 +0100 Subject: [PATCH 07/15] default_value for options is None --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 1644ef168..1f777963b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,7 +83,7 @@ struct CommonOpts { use_bz2: bool, /// Path to an auth-file to read authentication information from - #[clap(long, env = "RATTLER_AUTH_FILE", default_value = "None", hide = true)] + #[clap(long, env = "RATTLER_AUTH_FILE", hide = true)] auth_file: Option, } From 10c3b73dbd204a9e4b2db496339e6a3bdcc6abef Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sat, 16 Dec 2023 22:42:51 +0100 Subject: [PATCH 08/15] add integration to test auth-files and authentication with private repositories --- .../recipes/private-repository/recipe.yaml | 9 +++++ test/end-to-end/test_simple.py | 34 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test-data/recipes/private-repository/recipe.yaml diff --git a/test-data/recipes/private-repository/recipe.yaml b/test-data/recipes/private-repository/recipe.yaml new file mode 100644 index 000000000..4a44fb7e8 --- /dev/null +++ b/test-data/recipes/private-repository/recipe.yaml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json + +package: + name: "_testpackage_requiring_private_repo" + version: "1" + +requirements: + build: + - private-package diff --git a/test/end-to-end/test_simple.py b/test/end-to-end/test_simple.py index e904e5a74..0ed26d6ba 100644 --- a/test/end-to-end/test_simple.py +++ b/test/end-to-end/test_simple.py @@ -27,11 +27,17 @@ def build( recipe_folder: Path, output_folder: Path, variant_config: Optional[Path] = None, + custom_channels: list[str] | None = None, ): args = ["build", "--recipe", str(recipe_folder)] if variant_config is not None: args += ["--variant-config", str(variant_config)] args += ["--output-dir", str(output_folder)] + + if custom_channels: + for c in custom_channels: + args += ["--channel", c] + print(args) return self(*args) @@ -169,3 +175,31 @@ def test_pkg_hash(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path): pkg = get_package(tmp_path, "pkg_hash") expected_hash = variant_hash({"target_platform": host_subdir()}) assert pkg.name.endswith(f"pkg_hash-1.0.0-{expected_hash}_my_pkg.tar.bz2") + +@pytest.mark.skipif("PREFIX_DEV_READ_ONLY_TOKEN" not in os.environ, reason="requires PREFIX_DEV_READ_ONLY_TOKEN") +def test_auth_file(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, monkeypatch): + auth_file = tmp_path / "auth.json" + monkeypatch.setenv('RATTLER_AUTH_FILE', str(auth_file)) + + with pytest.raises(CalledProcessError): + rattler_build.build( + recipes / "private-repository", + tmp_path, + custom_channels=["conda-forge", "https://repo.prefix.dev/setup-pixi-test"], + ) + + auth_file.write_text( + json.dumps( + { + "repo.prefix.dev": { + "BearerToken": os.environ["PREFIX_DEV_READ_ONLY_TOKEN"] + } + } + ) + ) + + rattler_build.build( + recipes / "private-repository", + tmp_path, + custom_channels=["conda-forge", "https://repo.prefix.dev/setup-pixi-test"], + ) From 0502dcc28acdb4a021138135d56be6188a13c9cc Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sat, 16 Dec 2023 22:45:01 +0100 Subject: [PATCH 09/15] run end_to_end_tests in ci --- .github/workflows/end-to-end.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/end-to-end.yml b/.github/workflows/end-to-end.yml index e11ab971a..c13ff1504 100644 --- a/.github/workflows/end-to-end.yml +++ b/.github/workflows/end-to-end.yml @@ -38,4 +38,6 @@ jobs: # build in release mode so that it's reasonably fast to run the tests - run: cargo build --release - run: cargo test -p rust-tests -- --test-threads 1 - # - run: pixi run end_to_end_test + - run: pixi run end_to_end_test + env: + PREFIX_DEV_READ_ONLY_TOKEN: ${{ secrets.PREFIX_DEV_READ_ONLY_TOKEN }} From f42f2a744cb2bdf76f9e61d5baf58459e1a836e5 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sat, 16 Dec 2023 23:05:07 +0100 Subject: [PATCH 10/15] drive-by: we probably have most dependencies already compiled for release on disk, so compiling with --release is faster --- .github/workflows/end-to-end.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/end-to-end.yml b/.github/workflows/end-to-end.yml index c13ff1504..460e39a9c 100644 --- a/.github/workflows/end-to-end.yml +++ b/.github/workflows/end-to-end.yml @@ -37,7 +37,7 @@ jobs: cache: true # build in release mode so that it's reasonably fast to run the tests - run: cargo build --release - - run: cargo test -p rust-tests -- --test-threads 1 + - run: cargo test --release -p rust-tests -- --test-threads 1 - run: pixi run end_to_end_test env: PREFIX_DEV_READ_ONLY_TOKEN: ${{ secrets.PREFIX_DEV_READ_ONLY_TOKEN }} From 7ac55b0cc55db4d572e019aa10bda343c317224a Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sat, 16 Dec 2023 23:17:09 +0100 Subject: [PATCH 11/15] drive-by: actually pin toolchain version (see https://github.com/dtolnay/rust-toolchain/pull/91) --- .github/workflows/docs.yml | 2 +- .github/workflows/end-to-end.yml | 2 +- .github/workflows/rust-compile.yml | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 77c28c437..edbd808d4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -40,7 +40,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.68.0 + toolchain: '1.70.0' - name: Setup Pages uses: actions/configure-pages@v4 diff --git a/.github/workflows/end-to-end.yml b/.github/workflows/end-to-end.yml index 460e39a9c..07938ea22 100644 --- a/.github/workflows/end-to-end.yml +++ b/.github/workflows/end-to-end.yml @@ -30,7 +30,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.70.0 + toolchain: '1.70.0' - uses: prefix-dev/setup-pixi@v0.4.1 with: pixi-version: v0.5.0 diff --git a/.github/workflows/rust-compile.yml b/.github/workflows/rust-compile.yml index 5de4671e3..3280a5b20 100644 --- a/.github/workflows/rust-compile.yml +++ b/.github/workflows/rust-compile.yml @@ -30,7 +30,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.70.0 + toolchain: '1.70.0' - run: cargo check # check-rustdoc-links: @@ -42,7 +42,7 @@ jobs: # submodules: recursive # - uses: dtolnay/rust-toolchain@master # with: - # toolchain: 1.70.0 + # toolchain: '1.70.0' # - run: | # for package in $(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | .name'); do # cargo rustdoc -p "$package" --all-features -- -D warnings -W unreachable-pub @@ -67,7 +67,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.70.0 + toolchain: '1.70.0' - run: cargo test --all-features -- --nocapture build: @@ -115,7 +115,7 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: 1.70.0 + toolchain: '1.70.0' targets: ${{ matrix.job.target }} - name: Install cross @@ -286,7 +286,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: rustfmt - toolchain: 1.70.0 + toolchain: '1.70.0' - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all -- --check @@ -299,7 +299,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: clippy - toolchain: 1.70.0 + toolchain: '1.70.0' - uses: Swatinem/rust-cache@v2 - uses: actions-rs/clippy-check@v1 with: From afc14f4deafcee5ac1abddede8ff0e767d9a60b7 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sun, 17 Dec 2023 17:11:33 +0100 Subject: [PATCH 12/15] skip if PREFIX_DEV_READ_ONLY_TOKEN is not set or empty --- test/end-to-end/test_simple.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/end-to-end/test_simple.py b/test/end-to-end/test_simple.py index 0ed26d6ba..b7ebf5c54 100644 --- a/test/end-to-end/test_simple.py +++ b/test/end-to-end/test_simple.py @@ -176,7 +176,7 @@ def test_pkg_hash(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path): expected_hash = variant_hash({"target_platform": host_subdir()}) assert pkg.name.endswith(f"pkg_hash-1.0.0-{expected_hash}_my_pkg.tar.bz2") -@pytest.mark.skipif("PREFIX_DEV_READ_ONLY_TOKEN" not in os.environ, reason="requires PREFIX_DEV_READ_ONLY_TOKEN") +@pytest.mark.skipif(not os.environ.get("PREFIX_DEV_READ_ONLY_TOKEN", ""), reason="requires PREFIX_DEV_READ_ONLY_TOKEN") def test_auth_file(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, monkeypatch): auth_file = tmp_path / "auth.json" monkeypatch.setenv('RATTLER_AUTH_FILE', str(auth_file)) From 9c2cf1c54968c80db5bd6744e4756ad78f2d7352 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sun, 17 Dec 2023 19:05:33 +0100 Subject: [PATCH 13/15] fix rattler-build discovery for windows --- test/end-to-end/test_simple.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/end-to-end/test_simple.py b/test/end-to-end/test_simple.py index b7ebf5c54..4285bf6b1 100644 --- a/test/end-to-end/test_simple.py +++ b/test/end-to-end/test_simple.py @@ -48,11 +48,17 @@ def rattler_build(): return RattlerBuild(os.environ["RATTLER_BUILD_PATH"]) else: base_path = Path(__file__).parent.parent.parent - # use the default target release path, then debug - if (base_path / "target/release/rattler-build").exists(): - return RattlerBuild((base_path / "target/release/rattler-build")) - elif (base_path / "target/debug/rattler-build").exists(): - return RattlerBuild((base_path / "target/debug/rattler-build")) + executable_name = "rattler-build" + if os.name == 'nt': + executable_name += ".exe" + + release_path = base_path / f"target/release/{executable_name}" + debug_path = base_path / f"target/debug/{executable_name}" + + if release_path.exists(): + return RattlerBuild(release_path) + elif debug_path.exists(): + return RattlerBuild(debug_path) raise FileNotFoundError("Could not find rattler-build executable") From 5ba88b54fe549384a424ca27c5a4beef382578cc Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sun, 17 Dec 2023 19:07:18 +0100 Subject: [PATCH 14/15] also run on macos-latest --- .github/workflows/end-to-end.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/end-to-end.yml b/.github/workflows/end-to-end.yml index ecc799d95..f69d2de7f 100644 --- a/.github/workflows/end-to-end.yml +++ b/.github/workflows/end-to-end.yml @@ -19,7 +19,7 @@ jobs: run_tests: strategy: matrix: - os: ["ubuntu-latest", "windows-latest"] + os: ["ubuntu-latest", "windows-latest", "macos-latest"] fail-fast: false name: Run tests From f28f31f6bbabee7ae23e475fd5fb36598352c036 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sun, 17 Dec 2023 19:17:32 +0100 Subject: [PATCH 15/15] fix test_functionality on windows 1337 leetcode --- test/end-to-end/test_simple.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/end-to-end/test_simple.py b/test/end-to-end/test_simple.py index 4285bf6b1..2e3678a09 100644 --- a/test/end-to-end/test_simple.py +++ b/test/end-to-end/test_simple.py @@ -49,7 +49,7 @@ def rattler_build(): else: base_path = Path(__file__).parent.parent.parent executable_name = "rattler-build" - if os.name == 'nt': + if os.name == "nt": executable_name += ".exe" release_path = base_path / f"target/release/{executable_name}" @@ -64,7 +64,9 @@ def rattler_build(): def test_functionality(rattler_build: RattlerBuild): - assert rattler_build("--help").startswith("Usage: rattler-build [OPTIONS]") + suffix = ".exe" if os.name == "nt" else "" + + assert rattler_build("--help").startswith(f"Usage: rattler-build{suffix} [OPTIONS]") @pytest.fixture @@ -182,10 +184,16 @@ def test_pkg_hash(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path): expected_hash = variant_hash({"target_platform": host_subdir()}) assert pkg.name.endswith(f"pkg_hash-1.0.0-{expected_hash}_my_pkg.tar.bz2") -@pytest.mark.skipif(not os.environ.get("PREFIX_DEV_READ_ONLY_TOKEN", ""), reason="requires PREFIX_DEV_READ_ONLY_TOKEN") -def test_auth_file(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, monkeypatch): + +@pytest.mark.skipif( + not os.environ.get("PREFIX_DEV_READ_ONLY_TOKEN", ""), + reason="requires PREFIX_DEV_READ_ONLY_TOKEN", +) +def test_auth_file( + rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, monkeypatch +): auth_file = tmp_path / "auth.json" - monkeypatch.setenv('RATTLER_AUTH_FILE', str(auth_file)) + monkeypatch.setenv("RATTLER_AUTH_FILE", str(auth_file)) with pytest.raises(CalledProcessError): rattler_build.build( @@ -193,7 +201,7 @@ def test_auth_file(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, m tmp_path, custom_channels=["conda-forge", "https://repo.prefix.dev/setup-pixi-test"], ) - + auth_file.write_text( json.dumps( {