aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-22 10:41:22 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-22 10:41:22 +0100
commitb7b2f2d54261cc77be3658463d58b621ae29e1e6 (patch)
treec769ef16ae22fa20561d1e099179d2ef72a246af
parentb7d2755c97b93c391ca1de5856a0573e67f5b398 (diff)
downloaddotfiles-b7b2f2d54261cc77be3658463d58b621ae29e1e6.tar.gz
dotfiles-b7b2f2d54261cc77be3658463d58b621ae29e1e6.tar.bz2
dotfiles-b7b2f2d54261cc77be3658463d58b621ae29e1e6.zip
fix(pkg): mark declared packages as explicit on apply
`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).
-rw-r--r--justfile18
1 files 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