diff --git a/Cargo.lock b/Cargo.lock index ffb7a2ce3..ee38cc2d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3159,7 +3159,7 @@ dependencies = [ [[package]] name = "rattler" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "anyhow", "apple-codesign", @@ -3200,7 +3200,7 @@ dependencies = [ [[package]] name = "rattler_conda_types" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "chrono", "fxhash", @@ -3228,7 +3228,7 @@ dependencies = [ [[package]] name = "rattler_digest" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "blake2", "digest 0.10.7", @@ -3243,7 +3243,7 @@ dependencies = [ [[package]] name = "rattler_macros" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "quote", "syn 2.0.18", @@ -3252,7 +3252,7 @@ dependencies = [ [[package]] name = "rattler_networking" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "anyhow", "dirs 5.0.1", @@ -3269,7 +3269,7 @@ dependencies = [ [[package]] name = "rattler_package_streaming" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "bzip2", "chrono", @@ -3292,7 +3292,7 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "anyhow", "async-compression", @@ -3330,7 +3330,7 @@ dependencies = [ [[package]] name = "rattler_shell" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "enum_dispatch", "indexmap", @@ -3345,7 +3345,7 @@ dependencies = [ [[package]] name = "rattler_solve" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "anyhow", "cc", @@ -3366,7 +3366,7 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" version = "0.3.0" -source = "git+https://github.com/mamba-org/rattler?branch=main#f1ee61aa8665cc7b2d8a7452dd6f283a83c9c1ff" +source = "git+https://github.com/mamba-org/rattler?branch=main#a08f0ec4f6fc16a54ebbecda8ce1dfad3fdfca47" dependencies = [ "cfg-if", "libloading", diff --git a/src/environment.rs b/src/environment.rs index 812235da1..4ee19a94b 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -275,7 +275,7 @@ fn locked_dependency_satisfies( /// Updates the lock file for a project. pub async fn update_lock_file( project: &Project, - _existing_lock_file: CondaLock, + existing_lock_file: CondaLock, repodata: Option>, ) -> anyhow::Result { let platforms = project.platforms(); @@ -329,7 +329,10 @@ pub async fn update_lock_file( .map(|records| LibsolvRepoData::from_records(records)), // TODO: All these things. - locked_packages: vec![], + locked_packages: existing_lock_file + .packages_for_platform(platform) + .map(RepoDataRecord::try_from) + .collect::, _>>()?, pinned_packages: vec![], virtual_packages, }; @@ -337,39 +340,11 @@ pub async fn update_lock_file( // Solve the task let records = rattler_solve::LibsolvBackend.solve(task)?; + // Update lock file let mut locked_packages = LockedPackages::new(platform); for record in records { - locked_packages = locked_packages.add_locked_package(LockedPackage { - name: record.package_record.name, - version: record.package_record.version.to_string(), - build_string: record.package_record.build.to_string(), - url: record.url, - package_hashes: match (record.package_record.sha256, record.package_record.md5) { - (Some(sha256), Some(md5)) => PackageHashes::Md5Sha256(md5, sha256), - (Some(sha256), None) => PackageHashes::Sha256(sha256), - (None, Some(md5)) => PackageHashes::Md5(md5), - _ => unreachable!("package without any hash??"), - }, - dependency_list: record - .package_record - .depends - .iter() - .map(|dep| { - MatchSpec::from_str(dep) - .map_err(anyhow::Error::from) - .and_then(|spec| match &spec.name { - Some(name) => { - Ok((name.to_owned(), NamelessMatchSpec::from(spec).into())) - } - None => Err(anyhow::anyhow!( - "dependency MatchSpec missing a name '{}'", - dep - )), - }) - }) - .collect::>()?, - optional: None, - }); + let locked_package = LockedPackage::try_from(record)?; + locked_packages = locked_packages.add_locked_package(locked_package); } builder = builder.add_locked_packages(locked_packages); diff --git a/src/project/snapshots/pixi__project__manifest__test__invalid_target_specific.snap b/src/project/snapshots/pixi__project__manifest__test__invalid_target_specific.snap index 7e41e9eb1..03a30b500 100644 --- a/src/project/snapshots/pixi__project__manifest__test__invalid_target_specific.snap +++ b/src/project/snapshots/pixi__project__manifest__test__invalid_target_specific.snap @@ -1,10 +1,9 @@ --- source: src/project/manifest.rs -assertion_line: 230 expression: "examples.into_iter().map(|example|\n toml_edit::de::from_str::(&format!(\"{PROJECT_BOILERPLATE}\\n{example}\")).unwrap_err().to_string()).collect::>().join(\"\\n\")" --- TOML parse error at line 8, column 9 | 8 | [target.foobar.dependencies] | ^^^^^^ -'foobar' is not a known platform +'foobar' is not a known platform. Valid platforms are 'noarch', 'linux-32', 'linux-64', 'linux-aarch64', 'linux-armv6l', 'linux-armv7l', 'linux-ppc64le', 'linux-ppc64', 'linux-s390x', 'linux-riscv32', 'linux-riscv64', 'osx-64', 'osx-arm64', 'win-32', 'win-64', 'win-arm64', 'emscripten-32'