Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
83 changes: 37 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,24 @@ wax = "0.6.0"
which = "8.0.0"

# Rattler crates
file_url = "0.2.6"
rattler = { version = "0.34.10", default-features = false }
rattler_cache = { version = "0.3.28", default-features = false }
rattler_conda_types = { version = "0.37.0", default-features = false, features = [
file_url = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export" }
rattler = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_cache = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_conda_types = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false, features = [
"rayon",
] }
rattler_digest = { version = "1.1.5", default-features = false }
rattler_lock = { version = "0.23.13", default-features = false }
rattler_menuinst = { version = "0.2.20", default-features = false }
rattler_networking = { version = "0.25.8", default-features = false, features = [
rattler_digest = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_lock = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_menuinst = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_networking = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false, features = [
"google-cloud-auth",
"dirs",
] }
rattler_package_streaming = { version = "0.22.48", default-features = false }
rattler_repodata_gateway = { version = "0.23.9", default-features = false }
rattler_shell = { version = "0.24.7", default-features = false }
rattler_solve = { version = "2.1.8", default-features = false }
rattler_virtual_packages = { version = "2.1.1", default-features = false }
rattler_package_streaming = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_repodata_gateway = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_shell = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_solve = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
rattler_virtual_packages = { git = "https://github.com/remimimimimi/rattler.git", branch = "feat/extract-run-export", default-features = false }
simple_spawn_blocking = { version = "1.1.0", default-features = false }

# Bumping this to a higher version breaks the Windows path handling.
Expand Down
42 changes: 26 additions & 16 deletions crates/pixi_command_dispatcher/src/build/dependencies.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::str::FromStr;
use std::sync::Arc;

use itertools::Either;
use pixi_build_types::{
Expand All @@ -14,6 +15,7 @@ use rattler_conda_types::{
InvalidPackageNameError, MatchSpec, NamedChannelOrUrl, NamelessMatchSpec, PackageName,
ParseStrictness, Platform, VersionSpec,
};
use rattler_repodata_gateway::{Gateway, RunExportExtractorError, RunExportsReporter};

use super::conversion;
use crate::SourceMetadataError;
Expand Down Expand Up @@ -119,11 +121,13 @@ impl Dependencies {
}

/// Extract run exports from the solved environments.
pub fn extract_run_exports(
pub async fn extract_run_exports(
&self,
records: &[PixiRecord],
records: &mut [PixiRecord],
ignore: &CondaOutputIgnoreRunExports,
) -> PixiRunExports {
gateway: &Gateway,
reporter: Option<Arc<dyn RunExportsReporter>>,
) -> Result<PixiRunExports, RunExportExtractorError> {
let mut filter_run_exports = PixiRunExports::default();

fn filter_match_specs<T: From<BinarySpec>>(
Expand Down Expand Up @@ -200,24 +204,30 @@ impl Dependencies {
.collect()
}

for record in records {
let mut filtered_records = records
.iter_mut()
// Only record run exports for packages that are direct dependencies.
if !self
.dependencies
.contains_key(&record.package_record().name)
{
continue;
}

.filter(|r| !self.dependencies.contains_key(&r.package_record().name))
Comment thread
remimimimimi marked this conversation as resolved.
Outdated
// Filter based on whether we want to ignore run exports for a particular
// package.
if ignore.from_package.contains(&record.package_record().name) {
continue;
}
.filter(|r| ignore.from_package.contains(&r.package_record().name))
Comment thread
remimimimimi marked this conversation as resolved.
Outdated
.collect::<Vec<_>>();

let repodata_records = filtered_records.iter_mut().flat_map(|r| match *r {
PixiRecord::Binary(repo_data_record) => Some(repo_data_record),
PixiRecord::Source(_source_record) => None,
});
tracing::debug!("Making sure that run exports in pixi records");
gateway
.ensure_run_exports(repodata_records, reporter)
.await?;

for record in filtered_records {
// Make sure we have valid run exports.
let Some(run_exports) = &record.package_record().run_exports else {
unimplemented!("Extracting run exports from other places is not implemented yet");
unreachable!(
"We tried to make sure that run exports are available but something went wrong"
);
};

filter_run_exports
Expand All @@ -237,7 +247,7 @@ impl Dependencies {
.extend(filter_match_specs(&run_exports.weak_constrains, ignore));
}

filter_run_exports
Ok(filter_run_exports)
}
}

Expand Down
Loading
Loading