From b7b2f2d54261cc77be3658463d58b621ae29e1e6 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 22 May 2026 10:41:22 +0100 Subject: fix(pkg): mark declared packages as explicit on apply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `paru -S --needed` skips packages already on disk, so anything pulled in transitively first and *later* added to meta/*.txt stays marked as 'installed as a dependency' in the local pacman DB — and keeps showing up under `pacopt`. After each install pass, force the declared set to 'explicitly installed' via `pacman -D --asexplicit`. This treats meta/*.txt as the source of truth for install reason: anything listed there is explicit, anything else is a transitive dep. Idempotent on already-explicit packages (pacman just prints 'install reason is already explicit', which we discard). --- justfile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 431fce5..d9b9699 100644 --- a/justfile +++ b/justfile @@ -1064,6 +1064,17 @@ pkg-list group="": pkg-apply *groups: #!/bin/sh set -eu + # `paru -S --needed` is a no-op for already-installed packages, which + # means a package pulled in transitively (and later declared in + # meta/*.txt) stays marked "installed as a dependency" forever and + # keeps showing up under `pacopt`. After each install pass, force the + # declared set to "explicitly installed" so the local pacman DB + # reflects the meta files as the source of truth. + mark_explicit() { + # Skip blank input; pacman -D errors on empty arg list. + [ -n "$1" ] || return 0 + printf '%s\n' "$1" | xargs sudo pacman -D --asexplicit >/dev/null + } if [ -n "{{ groups }}" ]; then for group in {{ groups }}; do file="meta/${group}.txt" @@ -1074,12 +1085,15 @@ pkg-apply *groups: pkgs=$(sed -E 's/[[:space:]]*#.*$//; /^[[:space:]]*$/d' "$file") [ -n "$pkgs" ] || continue printf '%s\n' "$pkgs" | paru -S --needed --noconfirm --ask=4 - + mark_explicit "$pkgs" done else - find meta -maxdepth 1 -name '*.txt' ! -name 'flatpak.txt' -print0 \ + all_pkgs=$(find meta -maxdepth 1 -name '*.txt' ! -name 'flatpak.txt' -print0 \ | xargs -0 cat \ | sed -E 's/[[:space:]]*#.*$//; /^[[:space:]]*$/d' \ - | sort -u | paru -S --needed --noconfirm --ask=4 - + | sort -u) + printf '%s\n' "$all_pkgs" | paru -S --needed --noconfirm --ask=4 - + mark_explicit "$all_pkgs" [ -f meta/flatpak.txt ] && just _flatpak-install fi -- cgit v1.3.1