This commit is contained in:
2026-09-23 21:49:06 +02:00
parent 15d77eeaca
commit 496920cbdd
29 changed files with 399 additions and 493 deletions
+29 -40
View File
@@ -10,7 +10,7 @@
# - `stow --simulate` to prove every stow target resolves
# 2. REAL SMOKE (guarded by RUN_SMOKE=1)
# - resolves every @pacman entry against the repo DB
# - exercises term/setup.sh (pacman + npm) and re-runs it to prove
# - exercises setup/term/setup.sh (pacman + npm) and re-runs it to prove
# idempotency
# - verifies stow actually creates symlinks into $HOME
# AUR + kreation/buntes-monster only run with RUN_FULL=1.
@@ -78,9 +78,7 @@ done
# 1b. stow --simulate for every package the Makefile stows.
while IFS= read -r pkg; do
[[ -z "$pkg" ]] && continue
if stow --simulate --ignore='.stow-ignore' --ignore='scripts' \
--ignore='\.config/tmux/plugins' \
--dir="$REPO" --target="$REPO" "$pkg" 2>"$ERR_LOG"; then
if stow --simulate --dir="$REPO" --target="$REPO" "$pkg" 2>"$ERR_LOG"; then
say_ok "stow --simulate $pkg resolves"
else
say_fail "stow --simulate $pkg (non-existent package or conflict)"
@@ -141,7 +139,7 @@ NOOP
echo "[stub] chsh $*"
exit 0
NOOP
# The AUR section is stripped for the smoke, so term/setup.sh only ever
# The AUR section is stripped for the smoke, so setup/term/setup.sh only ever
# passes repo packages (+ npm) here; route yay through pacman directly.
# --noconfirm is needed because the container isn't interactive.
cat > "$HOME/bin/yay" <<'NOOP'
@@ -154,16 +152,11 @@ NOOP
export PATH="$HOME/bin:$PATH"
# 2c. setup.sh package parsing sanity (mirrors read_packages) for each
# package dir: basic/term/utils/hypr. term/ and hypr/ keep their scripts
# inside scripts/ so stowing the top-level dir only creates .config/ links.
for d in basic term utils hypr; do
if [[ "$d" == "term" || "$d" == "hypr" ]]; then
SETUP_PATH="$d/scripts/setup.sh"
PKG_PATH="$d/scripts/packages.txt"
else
SETUP_PATH="$d/setup.sh"
PKG_PATH="$d/packages.txt"
fi
# setup/$d target. All setup scripts + package lists live in setup/
# (outside the stow packages) and share setup/lib/common.sh.
for d in basic term utils hypr kreation; do
SETUP_PATH="setup/$d/setup.sh"
PKG_PATH="setup/$d/packages.txt"
if ( cd "$REPO" && bash -n "$SETUP_PATH" ); then
say_ok "$SETUP_PATH syntax OK"
else
@@ -189,12 +182,8 @@ NOOP
# AUR-only name (e.g. `rd`) fails here before any install happens.
header "package resolvability (@pacman entries)"
resolv_fail=0
for d in basic term utils hypr; do
if [[ "$d" == "term" || "$d" == "hypr" ]]; then
PKG_PATH="$d/scripts/packages.txt"
else
PKG_PATH="$d/packages.txt"
fi
for d in basic term utils hypr kreation; do
PKG_PATH="setup/$d/packages.txt"
while IFS= read -r pkg; do
[[ -z "$pkg" ]] && continue
if pacman -S --print-format '%n' "$pkg" >/dev/null 2>&1; then
@@ -214,44 +203,46 @@ NOOP
done
# 2d. If network allowed and not skipped, actually install the pacman
# and npm sections of term/setup.sh (mirrors `make term` without AUR;
# the @aur section stays RUN_FULL-gated since it needs yay/AUR builds).
# and npm sections of setup/term/setup.sh (mirrors `make term` without
# AUR; the @aur section stays RUN_FULL-gated since it needs yay/AUR builds).
if [[ "${SKIP_NET:-0}" != "1" ]]; then
header "make term (pacman + npm packages, AUR skipped)"
# Patch packages.txt: keep @pacman and @npm (@npm runs via sudo npm
# in the container), drop @aur so we don't hit AUR builds.
cp "$REPO/term/scripts/packages.txt" "$HOME/packages.txt.full"
cp "$REPO/setup/term/packages.txt" "$HOME/packages.txt.full"
awk '
/^@aur$/{s="skip"}; /^@npm$/{s="npm"}; /^@pacman$/{s="pacman"}
{ if (s!="skip" && NF>0 && $1 !~ /^#/) print }
' "$REPO/term/scripts/packages.txt" > "$HOME/packages.txt.term-smoke"
' "$REPO/setup/term/packages.txt" > "$HOME/packages.txt.term-smoke"
# pacman-only list for verify_packages.sh (npm packages are not in
# the pacman DB).
awk '
/^@aur$/{s="skip"}; /^@npm$/{s="skip"}; /^@pacman$/{s="pacman"}
{ if (s!="skip" && NF>0 && $1 !~ /^#/) print }
' "$REPO/term/scripts/packages.txt" > "$HOME/packages.txt.term-only"
# set a scratch HOME for setup.sh so it doesn't touch the real one.
mkdir -p "$HOME/term"
cp "$REPO/term/scripts/setup.sh" "$HOME/term/setup.sh"
cp "$HOME/packages.txt.term-smoke" "$HOME/term/packages.txt"
' "$REPO/setup/term/packages.txt" > "$HOME/packages.txt.term-only"
# Stage a scratch copy of the term setup incl. setup/lib/common.sh
# (setup.sh sources it via a path relative to its own location).
mkdir -p "$HOME/smoke/term" "$HOME/smoke/lib"
cp "$REPO/setup/term/setup.sh" "$HOME/smoke/term/setup.sh"
cp "$REPO/setup/lib/common.sh" "$HOME/smoke/lib/common.sh"
cp "$HOME/packages.txt.term-smoke" "$HOME/smoke/term/packages.txt"
# chsh is stubbed via $HOME/bin so even `chsh` works without a pty.
setup_ok=0
if ( cd "$HOME/term" && bash setup.sh ) ; then
say_ok "term/setup.sh (pacman+npm) completed"
if ( cd "$HOME/smoke/term" && bash setup.sh ) ; then
say_ok "setup/term/setup.sh (pacman+npm) completed"
setup_ok=1
else
say_fail "term/setup.sh (pacman+npm) failed (exit $?)"
say_fail "setup/term/setup.sh (pacman+npm) failed (exit $?)"
fi
# 2d1. Idempotency probe: a second run must also succeed. Catches
# steps that break on re-runs over an already-populated state (e.g.
# `ya pkg add` failing with "already exists").
if [[ "$setup_ok" == "1" ]]; then
if ( cd "$HOME/term" && bash setup.sh ) ; then
say_ok "term/setup.sh re-run: idempotent"
if ( cd "$HOME/smoke/term" && bash setup.sh ) ; then
say_ok "setup/term/setup.sh re-run: idempotent"
else
say_fail "term/setup.sh re-run failed (exit $?) - not idempotent"
say_fail "setup/term/setup.sh re-run failed (exit $?) - not idempotent"
fi
else
echo " skipping idempotency probe (first run did not complete)"
@@ -279,15 +270,13 @@ NOOP
# 2e. stow --actual into $HOME to prove real symlinks are created.
header "stow real symlinks into \$HOME"
# term/setup.sh may have just re-created the yazi plugin (`ya pkg add`)
# setup/term/setup.sh may have just re-created the yazi plugin (`ya pkg add`)
# as real files. The repo vendors the same plugin under term/.config/yazi,
# so drop the duplicate first, letting stow take ownership of that config.
rm -rf "$HOME/.config/yazi"
for pkg in term hypr kreation local_ai; do
if [[ -d "$REPO/$pkg" ]]; then
if stow --ignore='.stow-ignore' --ignore='scripts' \
--ignore='\.config/tmux/plugins' \
--dir="$REPO" --target="$HOME" "$pkg" 2>"$ERR_LOG"; then
if stow --dir="$REPO" --target="$HOME" "$pkg" 2>"$ERR_LOG"; then
say_ok "stow $pkg into \$HOME"
else
say_fail "stow $pkg into \$HOME"