feat: support source.filter for URL and archive path sources - #2608
Merged
Conversation
Extend the `filter` field (already available on `path` sources) to `url` sources. The filter is applied to the contents of the extracted archive, which lets large source tarballs be trimmed to just the files needed for the build (e.g. selecting only certain subprojects from a monorepo or excluding bundled `third_party` directories). The filter is wired through stage0 parsing/evaluation into the stage1 `UrlSource`, and applied via `CopyDir` when copying the extracted source out of the cache. This also makes the filter effective for `path` sources that point to an archive, since those reuse the same extraction code path. Closes #2581 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RxSDwdYTY8h7T8VRHR5wmD
source.filter for URL and archive path sources
Member
Author
|
I also submitted a CEP update: conda/ceps#176 |
16 tasks
Following CEP-0014 (conda/ceps#176), which specifies `filter` on `url`, `path`, and `git` sources, extend filter support to git sources as well. The filter is applied to the checked-out tree when copying it into the work directory, mirroring the url/path behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RxSDwdYTY8h7T8VRHR5wmD
Member
Author
|
Thanks for the pointer to conda/ceps#176. Since CEP-0014 specifies Generated by Claude Code |
Hofer-Julian
pushed a commit
to prefix-dev/recipe-format
that referenced
this pull request
Jun 30, 2026
Move the `filter` glob field from LocalSource up to BaseSource so that url, git, and path sources all support include/exclude glob filtering of the extracted source, matching prefix-dev/rattler-build#2608.
|
Super nice! 🤩 |
Merged
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.
Summary
This PR extends the
source.filterfield to supporturlsources andpathsources that point to archives. Previously, filtering was only available for git sources. The filter is now applied to the contents of extracted archives, allowing large source tarballs to be trimmed down to only the parts needed for the build.Key Changes
filterfield toUrlSourcein both stage0 and stage1 recipe structures with proper serialization handlingfilterfield alongside existing fields likeurl,sha256, andpatchescopy_from_cache()to accept and apply glob filters when copying extracted archive contents to the destination directorypathsource points to an archive file, it's now converted to a temporary URL source with the filter applied during extractionrecipe_file.mdshowing both simple list-based and include/exclude mapping-based filter syntax for URL sourcesImplementation Details
copy_dir::CopyDirbuilder with the newwith_globvec()method["cmake/*", "clang/*"]) and structured include/exclude mappingsIncludeExcludeandGlobVectypes already used for git source filteringfilter: []field in serialized outputhttps://claude.ai/code/session_01RxSDwdYTY8h7T8VRHR5wmD