Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0e2c540
feat: remove input hash from lockfile
nichtmacho Nov 30, 2025
ce0183d
misc: fix rustdoc
nichtmacho Dec 1, 2025
2acba68
misc: refactor to use a separate function
nichtmacho Dec 3, 2025
0ab0e70
misc: apply comments
nichtmacho Dec 3, 2025
315d5d3
Merge branch 'bas/wip/develop-dependencies' into feat/remove-input-ha…
nichtmacho Dec 3, 2025
ea76e8c
misc: fix rustodc
nichtmacho Dec 3, 2025
32285f6
misc: fix failing tests
nichtmacho Dec 3, 2025
d3e5b88
misc: update lockfile
nichtmacho Dec 4, 2025
6a68dc9
misc: update snapshots
nichtmacho Dec 4, 2025
b3b1368
misc: sort input_hash keys
nichtmacho Dec 5, 2025
0ac8fbb
wip
baszalmstra Dec 5, 2025
d4af4a6
fix: satisfiability issues
baszalmstra Dec 9, 2025
783656b
fix: lint issue
baszalmstra Dec 9, 2025
bc89801
fix: lint issue
baszalmstra Dec 9, 2025
1a60dbf
fix: changed globs
baszalmstra Dec 9, 2025
27fb179
fix: run exports not available for mock database
baszalmstra Dec 9, 2025
8e41db8
fix: snapshot
baszalmstra Dec 9, 2025
9c6f70b
Merge branch 'bas/wip/develop-dependencies' into feat/remove-input-ha…
baszalmstra Dec 11, 2025
674f8dc
feat: rewrite how we cache
baszalmstra Dec 11, 2025
9c5ba3f
fix: normalize directories
baszalmstra Dec 11, 2025
860de07
fix: clippy
baszalmstra Dec 11, 2025
e76f9a0
fix: path handling
baszalmstra Dec 12, 2025
e5b86a1
fix: cargo shear
baszalmstra Dec 16, 2025
98b4eff
test: verify change rebuilds
baszalmstra Dec 16, 2025
0de2830
fix: lint
baszalmstra Dec 16, 2025
e471d46
fix: ci issues
baszalmstra Dec 16, 2025
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
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,7 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
repository: nichmor/pixi-build-testsuite
ref: feat/change-manifest-path-to-path-in-pixi-build
repository: prefix-dev/pixi-build-testsuite

- name: Set up pixi
uses: prefix-dev/setup-pixi@main
Expand Down Expand Up @@ -945,8 +944,7 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
repository: nichmor/pixi-build-testsuite
ref: feat/change-manifest-path-to-path-in-pixi-build
repository: prefix-dev/pixi-build-testsuite

- name: Create Dev Drive
run: ${{ github.workspace }}/.github/workflows/setup-dev-drive.ps1
Expand Down Expand Up @@ -984,8 +982,7 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
repository: nichmor/pixi-build-testsuite
ref: feat/change-manifest-path-to-path-in-pixi-build
repository: prefix-dev/pixi-build-testsuite

- name: Set up pixi
uses: prefix-dev/setup-pixi@main
Expand Down
16 changes: 15 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pixi_glob = { path = "crates/pixi_glob" }
pixi_global = { path = "crates/pixi_global" }
pixi_install_pypi = { path = "crates/pixi_install_pypi" }
pixi_manifest = { path = "crates/pixi_manifest" }
pixi_path = { path = "crates/pixi_path" }
pixi_progress = { path = "crates/pixi_progress" }
pixi_pypi_spec = { path = "crates/pixi_pypi_spec" }
pixi_python_status = { path = "crates/pixi_python_status" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use pixi_consts::consts;
use rattler_conda_types::Platform;

use crate::{
common::{
LockFileExt, PixiControl,
},
common::{LockFileExt, PixiControl},
setup_tracing,
};
use pixi_test_utils::{MockRepoData, Package};
Expand Down
68 changes: 40 additions & 28 deletions crates/pixi_build_backend_passthrough/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn generate_variant_outputs(
project_model,
index_json,
params,
&BTreeMap::new(),
BTreeMap::new(),
)];
}

Expand All @@ -162,7 +162,7 @@ fn generate_variant_outputs(
project_model,
index_json,
params,
&BTreeMap::new(),
BTreeMap::new(),
)];
}

Expand All @@ -171,7 +171,7 @@ fn generate_variant_outputs(

// Create an output for each variant combination
combinations
.iter()
.into_iter()
.map(|variant| create_output(project_model, index_json, params, variant))
.collect()
}
Expand Down Expand Up @@ -297,9 +297,40 @@ fn create_output(
project_model: &ProjectModelV1,
index_json: &Option<IndexJson>,
params: &CondaOutputsParams,
variant: &BTreeMap<String, VariantValue>,
mut variant: BTreeMap<String, VariantValue>,
) -> CondaOutput {
let subdir = index_json
.as_ref()
.and_then(|j| j.subdir.as_deref())
.map(|subdir| subdir.parse().unwrap())
.unwrap_or(Platform::NoArch);

if !variant.contains_key("target_platform") {
variant.insert(
String::from("target_platform"),
VariantValue::from(subdir.to_string()),
);
}

CondaOutput {
build_dependencies: Some(extract_dependencies(
&project_model.targets,
|t| t.build_dependencies.as_ref(),
params.host_platform,
&variant,
)),
host_dependencies: Some(extract_dependencies(
&project_model.targets,
|t| t.host_dependencies.as_ref(),
params.host_platform,
&variant,
)),
run_dependencies: extract_dependencies(
&project_model.targets,
|t| t.run_dependencies.as_ref(),
params.host_platform,
&variant,
),
metadata: CondaOutputMetadata {
name: project_model
.name
Expand All @@ -326,36 +357,14 @@ fn create_output(
.as_ref()
.map(|j| j.build_number)
.unwrap_or_default(),
subdir: index_json
.as_ref()
.and_then(|j| j.subdir.as_deref())
.map(|subdir| subdir.parse().unwrap())
.unwrap_or(Platform::NoArch),
subdir,
license: project_model.license.clone(),
license_family: None,
noarch: index_json.as_ref().map(|j| j.noarch).unwrap_or_default(),
purls: None,
python_site_packages_path: None,
variant: variant.clone(),
},
build_dependencies: Some(extract_dependencies(
&project_model.targets,
|t| t.build_dependencies.as_ref(),
params.host_platform,
variant,
)),
host_dependencies: Some(extract_dependencies(
&project_model.targets,
|t| t.host_dependencies.as_ref(),
params.host_platform,
variant,
)),
run_dependencies: extract_dependencies(
&project_model.targets,
|t| t.run_dependencies.as_ref(),
params.host_platform,
variant,
),
},
ignore_run_exports: Default::default(),
run_exports: Default::default(),
input_globs: None,
Expand Down Expand Up @@ -498,6 +507,9 @@ pub struct PassthroughBackendConfig {
/// The path to a pre-build conda package.
pub package: Option<PathBuf>,

/// Whether this is a noarch package
pub noarch: Option<bool>,

/// Build globs
pub build_globs: Option<BTreeSet<String>>,
}
Expand Down
1 change: 1 addition & 0 deletions crates/pixi_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pixi_diff = { workspace = true }
pixi_git = { workspace = true }
pixi_global = { workspace = true }
pixi_manifest = { workspace = true, features = ["rattler_lock"] }
pixi_path = { workspace = true }
pixi_progress = { workspace = true }
pixi_pypi_spec = { workspace = true }
pixi_record = { workspace = true }
Expand Down
13 changes: 11 additions & 2 deletions crates/pixi_cli/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use pixi_consts::consts::{
};
use pixi_core::{WorkspaceLocator, environment::sanity_check_workspace, workspace::DiscoveryStart};
use pixi_manifest::FeaturesExt;
use pixi_path::AbsPathBuf;
use pixi_progress::global_multi_progress;
use pixi_record::{PinnedPathSpec, PinnedSourceSpec};
use pixi_reporters::TopLevelProgress;
Expand Down Expand Up @@ -187,9 +188,17 @@ pub async fn execute(args: Args) -> miette::Result<()> {
// Construct a command dispatcher based on the workspace.
let multi_progress = global_multi_progress();
let anchor_pb = multi_progress.add(ProgressBar::hidden());
let mut cache_dirs =
CacheDirs::new(pixi_config::get_cache_dir()?).with_workspace(workspace.pixi_dir());
let cache_dir = AbsPathBuf::new(pixi_config::get_cache_dir()?)
.expect("cache dir is not absolute")
.into_assume_dir();
let workspace_dir = AbsPathBuf::new(workspace.pixi_dir())
.expect("pixi dir is not absolute")
.into_assume_dir();
let mut cache_dirs = CacheDirs::new(cache_dir).with_workspace(workspace_dir);
if let Some(build_dir) = args.build_dir {
let build_dir = AbsPathBuf::new(build_dir)
.expect("build dir is not absolute")
.into_assume_dir();
cache_dirs.set_working_dirs(build_dir);
}
let command_dispatcher = workspace
Expand Down
2 changes: 1 addition & 1 deletion crates/pixi_command_dispatcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ itertools = { workspace = true }
miette = { workspace = true }
once_cell = { workspace = true }
ordermap = { workspace = true }
pathdiff = { workspace = true }
pin-project-lite = { workspace = true }
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] }
Expand Down Expand Up @@ -55,6 +54,7 @@ pixi_build_types = { workspace = true }
pixi_consts = { workspace = true }
pixi_git = { workspace = true }
pixi_glob = { workspace = true }
pixi_path = { workspace = true }
pixi_record = { workspace = true }
pixi_spec = { workspace = true }
pixi_spec_containers = { workspace = true }
Expand Down
40 changes: 34 additions & 6 deletions crates/pixi_command_dispatcher/src/backend_source_build/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! See [`BackendSourceBuildSpec`]

use std::{
collections::{BTreeMap, BTreeSet},
collections::{BTreeMap, BTreeSet, BinaryHeap},
fmt::Display,
path::PathBuf,
};
Expand All @@ -18,7 +18,7 @@ use pixi_build_types::{
CondaBuildV1PrefixPackage, CondaBuildV1Result, CondaBuildV1RunExports,
},
};
use pixi_record::PinnedSourceSpec;
use pixi_glob::GlobSet;
use pixi_spec::{BinarySpec, PixiSpec, SpecConversionError};
use rattler_conda_types::{
ChannelConfig, ChannelUrl, MatchSpec, PackageName, Platform, RepoDataRecord,
Expand Down Expand Up @@ -46,8 +46,9 @@ pub struct BackendSourceBuildSpec {
/// The package that we are building.
pub package: PackageIdentifier,

/// The source location of the package that we are building.
pub source: PinnedSourceSpec,
/// The directory where the source code is located on disk.
#[serde(skip)]
pub source_dir: PathBuf,

/// The method to use for building the source package.
pub method: BackendSourceBuildMethod,
Expand Down Expand Up @@ -116,7 +117,11 @@ pub struct BackendBuiltSource {

/// The globs that were used as input to the build. Use these for
/// re-verifying the build.
pub input_globs: BTreeSet<String>,
pub input_globs: BinaryHeap<String>,

/// The actual files that matched the globs at build time. This allows
/// detecting file deletions and additions.
pub input_files: BTreeSet<PathBuf>,
}

impl BackendSourceBuildSpec {
Expand All @@ -130,6 +135,7 @@ impl BackendSourceBuildSpec {
self.backend,
self.package,
params,
self.source_dir,
self.work_directory,
self.channels,
self.channel_config,
Expand All @@ -140,10 +146,12 @@ impl BackendSourceBuildSpec {
}
}

#[allow(clippy::too_many_arguments)]
async fn build_v1(
backend: Backend,
record: PackageIdentifier,
params: BackendSourceBuildV1Method,
source_dir: PathBuf,
work_directory: PathBuf,
channels: Vec<ChannelUrl>,
channel_config: ChannelConfig,
Expand Down Expand Up @@ -284,8 +292,25 @@ impl BackendSourceBuildSpec {
));
};

// Compute the files that match the input globs.
let glob_set = GlobSet::create(built_package.input_globs.iter().map(String::as_str));
let input_files = glob_set
.collect_matching(&source_dir)
.map_err(BackendSourceBuildError::GlobSet)
.map_err(CommandDispatcherError::Failed)?
.into_iter()
.filter_map(|entry| {
entry
.into_path()
.strip_prefix(&source_dir)
.ok()
.map(|p| p.to_path_buf())
})
.collect();

Ok(BackendBuiltSource {
input_globs: built_package.input_globs,
input_globs: built_package.input_globs.into_iter().collect(),
input_files,
output_file: built_package.output_file,
})
}
Expand Down Expand Up @@ -379,6 +404,9 @@ pub enum BackendSourceBuildError {

#[error(transparent)]
UnexpectedPackage(UnexpectedPackageError),

#[error(transparent)]
GlobSet(#[from] pixi_glob::GlobSetError),
}

/// An error that can occur when the build backend did not return the expected
Expand Down
Loading
Loading