From b7abd97caf727928c78580a114c55c9dc54f94ca Mon Sep 17 00:00:00 2001
From: prsabahrami
Date: Thu, 5 Sep 2024 21:02:03 -0400
Subject: [PATCH] Update dependencies
---
extractor/Cargo.toml | 14 +++++++-------
extractor/src/main.rs | 34 +++++++++++++++++++---------------
2 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/extractor/Cargo.toml b/extractor/Cargo.toml
index a335285..f952b83 100644
--- a/extractor/Cargo.toml
+++ b/extractor/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
anyhow = "1.*"
futures = "0.3.30"
-rattler = { version = "0.27.5", default-features = false }
+rattler = { version = "0.27.6", default-features = false }
rattler_digest = "1.0.1"
rattler_conda_types = "0.27.2"
rattler_index = "0.19.24"
@@ -14,19 +14,19 @@ rattler_lock = "0.22.20"
rattler_networking = { version = "0.21.1", default-features = false }
rattler_package_streaming = { version = "0.22.3", default-features = false }
rattler_shell = "0.21.6"
-reqwest = { version = "0.12.5", default-features = false, features = [
+reqwest = { version = "0.12.7", default-features = false, features = [
"http2",
"macos-system-configuration",
] }
-reqwest-middleware = "0.3.2"
-serde = { version = "1.0.204", features = ["derive"] }
-serde_json = "1.0.121"
+reqwest-middleware = "0.3.3"
+serde = { version = "1.0.209", features = ["derive"] }
+serde_json = "1.0.127"
serde_yaml = "0.9.34"
-tokio = { version = "1.39.2", features = ["rt-multi-thread"] }
+tokio = { version = "1.40.0", features = ["rt-multi-thread"] }
tokio-stream = { version = "0.1.15", features = ["fs"] }
url = "2.5.2"
fxhash = "0.2.1"
-tempfile = "3.10.1"
+tempfile = "3.12.0"
[dev-dependencies]
rstest = "0.22.0"
diff --git a/extractor/src/main.rs b/extractor/src/main.rs
index d940bff..dbd28d6 100644
--- a/extractor/src/main.rs
+++ b/extractor/src/main.rs
@@ -6,7 +6,7 @@ use tokio_stream::wrappers::ReadDirStream;
use anyhow::anyhow;
use anyhow::Result;
-use futures::{stream, StreamExt, TryStreamExt};
+use futures::{stream, StreamExt, TryFutureExt, TryStreamExt};
use rattler::{
install::Installer,
package_cache::{CacheKey, PackageCache},
@@ -60,11 +60,12 @@ async fn main() -> Result<()> {
/// Unpack a pixi environment from a directory
pub async fn unpack(archive_dir: &Path, output_dir: &Path) -> Result<()> {
let channel_directory = archive_dir.join(std::env::var("PIXI_PACK_CHANNEL_DIRECTORY").unwrap());
+ let cache_dir = archive_dir.join("cache");
validate_metadata_file(archive_dir.join(std::env::var("PIXI_PACK_METADATA_PATH").unwrap()))
.await?;
- create_prefix(&channel_directory, output_dir)
+ create_prefix(&channel_directory, output_dir, &cache_dir)
.await
.map_err(|e| anyhow!("Could not create prefix: {}", e))?;
@@ -136,20 +137,16 @@ async fn collect_packages(channel_dir: &Path) -> Result Result<()> {
+async fn create_prefix(channel_dir: &Path, target_prefix: &Path, cache_dir: &Path) -> Result<()> {
let packages = collect_packages(channel_dir)
.await
.map_err(|e| anyhow!("could not collect packages: {}", e))?;
- let cache_dir = tempfile::tempdir()
- .map_err(|e| anyhow!("could not create temporary directory: {}", e))?
- .into_path();
-
eprintln!(
- "⏳ Extracting and installing {} packages...",
- packages.len()
+ "⏳ Extracting and installing {} packages to {}...",
+ packages.len(),
+ cache_dir.display()
);
-
// extract packages to cache
let package_cache = PackageCache::new(cache_dir);
@@ -175,13 +172,20 @@ async fn create_prefix(channel_dir: &Path, target_prefix: &Path) -> Result<()> {
package_cache
.get_or_fetch(
cache_key,
- |destination| async move {
- extract(&package_path, &destination).map(|_| ())
+ move |destination| {
+ let package_path_clone = package_path.clone();
+ async move { extract(&package_path_clone, &destination).map(|_| ()) }
},
None,
)
.await
- .map_err(|e| anyhow!("could not extract package: {}", e))?;
+ .map_err(|e| {
+ anyhow!(
+ "could not extract \"{}\": {}",
+ repodata_record.as_ref().name.as_source(),
+ e
+ )
+ })?;
Ok::(repodata_record)
}
@@ -204,8 +208,8 @@ async fn create_prefix(channel_dir: &Path, target_prefix: &Path) -> Result<()> {
history_path,
"// not relevant for pixi but for `conda run -p`",
)
- .await
- .map_err(|e| anyhow!("Could not write history file: {}", e))?;
+ .map_err(|e| anyhow!("Could not write history file: {}", e))
+ .await?;
Ok(())
}