3 releases (breaking)
Uses new Rust 2024
| 0.3.0 | Mar 15, 2026 |
|---|---|
| 0.2.0 | Feb 28, 2026 |
| 0.1.0 | Feb 8, 2026 |
#373 in Rust patterns
265KB
5.5K
SLoC
portage-atom-resolvo
Bridge between portage-atom and the resolvo SAT-based dependency solver.
Warning: This codebase was largely AI-generated (slop-coded) and has not yet been thoroughly audited. It may contain bugs, incomplete PMS coverage, or surprising edge-case behaviour. Use at your own risk and please report issues.
Quick start
cargo run --example resolve
cargo run --example resolve_conflict
See examples/resolve.rs for a complete walkthrough
that builds an in-memory repository, declares transitive / any-of / slotted /
USE-conditional dependencies, and prints the solved package set.
See examples/resolve_conflicts.rs for a
the initial error reporting layout.
Feature checklist
Working
- Version matching - all 7 PMS 8.3.1 operators (
<<==>=>~=*) - Transitive dependency resolution via resolvo's CDCL SAT solver
- Newest-first version preference (
sort_candidatesdescending) -
|| ( a b )any-of groups ->Requirement::Union - USE-conditional deps (
use? ( ... ),!use? ( ... )) - eagerly evaluated or solver-decided viaUseConfig - Blockers (
!atom,!!atom) -> resolvoconstrains, with weak/strong distinction tracked viablocker_type() - Multi-slot coexistence (
python:3.11+python:3.12in same solution) - Unslotted deps resolve across all known slots (union)
- Slot-specific deps (
:3.12) target only that slot's candidates - Slot operator
:*(accept any slot) - Slot operator
:=tracking -is_rebuild_trigger()flags deps that need rebuilds on slot/subslot changes - Sub-slot matching -
:SLOT/SUBSLOTconstraints checked infilter_candidates - Strong vs weak blocker distinction -
blocker_type()returnsBlocker::WeakorBlocker::Strong - Repository constraint (
::gentoo) -PackageMetadata::repo+VersionConstraint::repofiltering infilter_candidates - USE dep constraints on atoms (
[ssl,-debug]) - all 6 PMS 8.3.4 variants, conditional forms resolved eagerly againstUseConfig -
DEPEND/RDEPEND/BDEPEND/PDEPEND/IDEPENDseparation -PackageDepsstruct with per-class fields, all treated as requirements - Arena-based interning with dedup for names and version sets
-
InMemoryRepositoryfor testing - Public API:
intern_requirement()->Problem->Solver::solve() - Circular dependency handling via
PDEPEND-dependency_graph()returns dep-class–labeled edges,install_order()uses Kahn's toposort with PDEPEND relaxation - Installed-package database -
InstalledSet+with_installed()constructor;Candidates::favored(soft preference) andCandidates::locked(hard constraint) per name
Not yet implemented
- Better human-readable conflict/error reporting
Architecture
lib.rs re-exports
version_match.rs version_matches(candidate, op, constraint) -> bool
pool.rs PortagePool arena (resolvo IDs <-> portage-atom types)
repository.rs PackageRepository trait + InMemoryRepository
provider.rs Interner + DependencyProvider impl
Running checks
cargo test # 75 tests
cargo clippy -- -D warnings # clean
cargo fmt --check # formatted
cargo doc --no-deps # no warnings
Related Projects
- PMS - Package Manager Specification
- Portage - Reference Gentoo package manager
- pkgcraft - Full-featured Gentoo package manager library
License
Contributing
Contributions welcome! Please ensure:
- Tests pass (
cargo test) - Code is formatted (
cargo fmt) - No clippy warnings (
cargo clippy) - PMS compliance is maintained
Conventional Commits
This project uses Conventional Commits. Prefix your commit messages with a type:
feat:— new functionalityfix:— bug fixrefactor:— code restructuring without behaviour changedocs:— documentation onlytest:— adding or updating testschore:— maintenance (CI, dependencies, tooling)
Author
Luca Barbato lu_zero@gentoo.org
Dependencies
~14MB
~187K SLoC