fix: stop source builds rebuilding from scratch on every run#6285
Open
baszalmstra wants to merge 1 commit into
Open
fix: stop source builds rebuilding from scratch on every run#6285baszalmstra wants to merge 1 commit into
baszalmstra wants to merge 1 commit into
Conversation
…dev#6232) Source packages that keep their build variants in a separate `variants.yaml`, with the recipe shared from a parent directory, were rebuilt on every command even when nothing had changed. The build cache was not tracking the files that live outside the package's own directory (such as the shared recipe), so on every run it treated them as newly added and discarded the cached build. Both the source-build artifact cache and the build-backend metadata cache now record those files correctly, so the cache is reused and a package is only rebuilt when its source actually changes. Fixes prefix-dev#6232 https://claude.ai/code/session_01PrTktKPKFCjBgUJcoXYGVn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Source packages that keep their build variants in a separate
variants.yaml, with the recipe shared from a parent directory, were rebuilt from scratch on every command even when nothing had changed.The build cache decides whether a package needs rebuilding by checking the files that went into the previous build. It was not tracking the files that live outside the package's own directory (such as the shared recipe and build script), so on every run it saw them as newly added and threw the cached build away.
This change makes the cache record and re-check those files correctly, so a build is reused until its inputs actually change. The same handling is applied to both the source build cache and the build backend metadata cache, so the two stay consistent. The result matches the behaviour you already get when variants are declared inline with
[workspace.build-variants].Fixes #6232
How Has This Been Tested?
Added a regression test that reproduces the issue's project layout (a package whose recipe lives in a parent directory) and confirms the build is reused on the second run instead of rebuilt, plus unit tests for the file matching that the caches rely on. The full
pixi_command_dispatchertest suite passes and the project builds cleanly.AI Disclosure
Tools: Claude
Checklist: