Skip to content

add portage backend - #3676

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
EmiOnFlux:master
Oct 4, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
EmiOnFlux:master

Conversation

@EmiOnFlux

Copy link
Copy Markdown
Contributor

Description

Adds a portage Backend, for Gentoo system updates

  • A majority of this PR was made with AI Assitance

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Screenshots / video

Checklist

@purian23

purian23 commented Oct 3, 2026

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Claude review

Two bugs need fixing before merge.

  • Background update checks run pkexec emerge --sync, so polkit prompts appear unprompted and come back on every retry, core/internal/server/sysupdate/backend_portage.go:125
  • Ignored packages are not honored: emerge @world never reads opts.Ignored, core/internal/server/sysupdate/backend_portage.go:83
    Checked: backend registration, check/upgrade flow against manager.go and targets.go, the update-line regex and version parsing, how RepoKind is used in the QML service. Model: claude-opus-5-5.

@purian23

purian23 commented Oct 4, 2026

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Claude review

The --exclude fix works for normal updates. Interactive updates still drop portage ignores. The earlier emerge --sync polkit prompt on background checks has not been fixed yet.

  • Interactive updates drop category/name ignores because shellSafeNames rejects /, so held portage packages still get upgraded. quickshell/Services/SystemUpdateService.qml:97
    Checked: the new --exclude argv and the portage-first step, how ignores reach the backend through manager.go (normal and interactive paths) and the dms CLI, the QML ignore-name validator. Model: claude-opus-5-5.

@hthienloc

Copy link
Copy Markdown
Member

/claude review

if err != nil {
if exitErr, ok := errors.AsType[*exec.ExitError](err); ok {
switch exitErr.ExitCode() {
case 1:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emerge --pretend exits 0 when it lists updates. It exits 1 when dependency resolution fails, for example a slot conflict, a blocker, or masked or keyworded deps. This branch turns that failure into a successful check. The output has no [ebuild lines, so the user sees "up to date" while their @world is actually broken. Return the error here instead, and include the captured stderr so the log shows why. Note that cmd.Output() currently throws stderr away.

@claude

claude Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Claude review

Interactive updates now keep portage ignores, because safePkgName allows /. The earlier pkexec emerge --sync on background checks is still there (existing comment at backend_portage.go:187). One new issue:

  • A failed emerge --pretend (exit 1) is reported as "no updates", so dependency-resolution failures are hidden. core/internal/server/sysupdate/backend_portage.go:197
    Checked: the ignore paths through manager.go (normal and interactive), the dms CLI filterUpdateTargets switching to slot-aware matching for every backend, the safePkgName change, the QML validator and matcher, and how the repo label is used in QML. Model: claude-opus-5-5.

@hthienloc

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Claude review

No new issues found. A failed emerge --pretend now returns an error with stderr attached, so it no longer shows as "up to date". One earlier issue is still open: background checks run pkexec emerge --sync, which pops up polkit prompts nobody asked for (existing comment at backend_portage.go:187). The new code comment says this is deliberate, but the prompt keeps coming back on every retry if the user dismisses it.
Checked: the capturePortageUpdates error path and its test, the --exclude argv, slot-aware ignore matching in Go and QML, portageIsExcluded for the portage-first step, the safePkgName change and the QML name validator, how manager.go drops ignored targets. Model: claude-opus-5-5.

@EmiOnFlux

Copy link
Copy Markdown
Contributor Author

Yeah, the pkexec is deliberate, there is no clean way to look for updates without root, if someone knowingly setups background updates anyway they will deal have to deal with pkexec prompts

@EmiOnFlux

Copy link
Copy Markdown
Contributor Author

Possible Workarounds (Albeit they all suck and shouldn't be done):

  • Ship a PK rule/action that allows users to run emerge --sync without auth
  • Require the user to chown all the repo dirs to themselves
  • Create a temporary copy of the repos everytime when checking for updates, then sync the actual repos with root during install

@bbedward
bbedward merged commit 375aa2f into duxlabs-dev:master Oct 4, 2026
4 checks passed
ignacypekala pushed a commit to ignacypekala/dux-shell that referenced this pull request Oct 5, 2026
* add portage backend

* portage: add excludes
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.

4 participants