Skip to content

feat: improve dependency resolution, emerge reliability, and documentation audit#68

Merged
kolkov merged 8 commits into
mainfrom
feat/resolver-improvements
Feb 8, 2026
Merged

feat: improve dependency resolution, emerge reliability, and documentation audit#68
kolkov merged 8 commits into
mainfrom
feat/resolver-improvements

Conversation

@kolkov
Copy link
Copy Markdown
Contributor

@kolkov kolkov commented Feb 8, 2026

Summary

Major improvements to dependency resolution, ebuild execution, and comprehensive documentation audit.

Resolver improvements:

  • Metadata cache support (md5-cache) for 10x faster package loading
  • Variable expansion fix (bash += operator, ${VAR} in make.defaults)
  • USE_EXPAND support for Python/Lua/Ruby targets in resolution and display
  • OR-group preference for installed packages (stable resolution matching Portage)
  • Zstd unpack support (.tar.zst)

Emerge improvements:

  • --keep-going / -k now works in sequential mode (was parallel-only)
  • Panic recovery via defer/recover for interpreter crashes (e.g., unsupported @a expansion)
  • Comprehensive unpack using helpers.unpackArchive() instead of limited extractTarball()
  • Non-archive files (.sig, .asc, .patch) skipped during unpack
  • Implicit --replace when --deep is used

Documentation audit (8 files fixed):

  • README: download URL fixed to match GoReleaser naming (x86_64 not amd64)
  • README: CMake/Meson/language support clarified as "basic" not "full"
  • CLI_REFERENCE: 5 missing emerge flags added, depclean section added, update section corrected
  • ARCHITECTURE/CLI_REFERENCE: REST API fixed from 127.0.0.1:8080 to Unix socket
  • CHANGELOG: 9 missing version link references added (v0.8.0-v0.9.3)
  • PMS_COMPLIANCE: pkg_nofetch status corrected to "Full"
  • INSTALL: archive filenames corrected to match GoReleaser output
  • ROADMAP: version marker and coverage stats updated

Tested on real Gentoo WSL2: 485 packages resolved, 100% match with Portage output.

Test plan

  • go test ./internal/... passes
  • golangci-lint run passes
  • Cross-compile: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./cmd/grpm
  • Verify documentation links render correctly on GitHub
  • Spot-check CLI_REFERENCE depclean section formatting

- Fix CLI flag parsing: flags now work after positional args (Portage-compatible)
- Fix OR-group dependency collection: alternatives added to SAT solver graph
- Add post-SAT resolution pass with OR-group support (iterative convergence)
- Add .tar.zst/.zst unpack support via klauspost/compress
- Add standalone .gz/.bz2/.xz/.zst decompression
- Show technical error details in UserError output

Resolver accuracy: 87% match with Portage @world --deep resolution
(137/158 packages, up from ~60% before fixes)
- Read Portage metadata cache (md5-cache) for accurate eclass-merged values
  This correctly handles acct-group/acct-user KEYWORDS, app-alternatives
  RDEPEND generation, and any eclass variable inheritance
- Add shell variable expansion in profile make.defaults ( and $VAR)
  Fixes incremental USE assignments: USE="${USE} seccomp"
- Support bash += append operator in ebuild parser (BDEPEND+="...")
- Fix multiline regex to use (?ms) flags for proper line-start matching

Test results: 334 packages resolved vs 158 from Portage (5 remaining due
to USE_EXPAND not yet handled). Previously 272 packages (21 missing).
Expand PYTHON_SINGLE_TARGET, PYTHON_TARGETS, LUA_SINGLE_TARGET,
LUA_TARGETS, RUBY_TARGETS from make.conf/profile into USE flags.
This enables resolution of Python-conditional dependencies like
dev-python/lxml, dev-python/cython, dev-python/markupsafe.

Result: 158/158 Portage packages now in GRPM resolution (was 153/158).
Only 2 packages differ: groff/man-db (OR-group preference, not a bug).
When resolving OR-group dependencies (e.g., virtual/man provides
|| ( sys-apps/man-db app-text/mandoc )), reorder alternatives to
put already-installed packages first. SAT solvers typically assign
positive values to earlier variables, creating a soft preference
for keeping installed packages. This matches Portage behavior.
Add USE_EXPAND variable expansion to pretend display formatter so
PYTHON_TARGETS, PYTHON_SINGLE_TARGET, LUA_TARGETS, RUBY_TARGETS
show correct enabled/disabled state from make.conf. Also expand
USE_EXPAND prefix list with abi_*, llvm_targets_*, lua_single_target_*
for proper grouping in output.
…covery

Wire --keep-going flag to sequential build path (previously only worked
with parallel -j > 1). Add panic recovery wrapper around per-package
build/install so interpreter panics (e.g., unsupported bash features
like @A expansion) don't crash the entire emerge process.

Build summary now shows failed package count and names at the end.
Replace limited extractTarball() with helpers.unpackArchive() in default
src_unpack phase, adding support for .tar.zst, .zip, .gz, .bz2, .xz,
.zst formats. Skip PGP signature files (.sig, .asc, .sign) and patches
(.patch, .diff) that are not meant to be extracted.

Also implicitly enable --replace when --deep is used, since installed
packages will be in the solution and need to be rebuilt.
- README: fix download URL format (GoReleaser produces x86_64, not amd64)
- README: clarify CMake/Meson/language ecosystem support as basic, not full
- CHANGELOG: add missing version link references (v0.8.0-v0.9.3)
- CHANGELOG: fix documentation URL from master to main branch
- CLI_REFERENCE: add missing emerge flags (--replace, --force, --keep-going, --make-jobs, --info)
- CLI_REFERENCE: fix --jobs description (parallel packages vs make jobs)
- CLI_REFERENCE: add depclean command section
- CLI_REFERENCE: update 'update' command with real flags (--newuse, --changed-use, --ask)
- CLI_REFERENCE: fix REST API from HTTP 127.0.0.1:8080 to Unix socket
- ARCHITECTURE: fix REST API endpoint to unix:///var/run/grpm-rest.sock
- PMS_COMPLIANCE: fix pkg_nofetch status from 'Not Yet' to 'Full' (implemented)
- ROADMAP: update current version marker from v0.9.0 to v0.9.3
- ROADMAP: fix tree coverage from ~75% to ~98% in section header
- INSTALL: fix archive filenames to match GoReleaser naming (x86_64, armv7, etc.)
- CONTRIBUTING: update 'Areas Needing Help' (EAPI 8 is done, list real needs)
@kolkov kolkov merged commit f4f9567 into main Feb 8, 2026
3 checks passed
@kolkov kolkov deleted the feat/resolver-improvements branch February 8, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant