refactor
This commit is contained in:
+18
-20
@@ -77,19 +77,14 @@ else
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 4. packages.txt parsing sanity (mirrors each setup.sh read_packages).
|
||||
# 4. packages.txt parsing sanity (mirrors setup/lib/common.sh read_packages).
|
||||
# ---------------------------------------------------------------------------
|
||||
echo "== Checking packages.txt markers =="
|
||||
for pkgdir in term basic utils hypr; do
|
||||
# term/ and hypr/ keep packages.txt + setup.sh inside scripts/ so stowing
|
||||
# the top-level dir only creates .config/ symlinks.
|
||||
if [[ "$pkgdir" == "term" || "$pkgdir" == "hypr" ]]; then
|
||||
PKG_FILE="$pkgdir/scripts/packages.txt"
|
||||
SETUP_FILE="$pkgdir/scripts/setup.sh"
|
||||
else
|
||||
PKG_FILE="$pkgdir/packages.txt"
|
||||
SETUP_FILE="$pkgdir/setup.sh"
|
||||
fi
|
||||
for pkgdir in term basic utils hypr kreation; do
|
||||
# Setup scripts + package lists live in setup/ (outside the stow
|
||||
# packages), sharing one parser in setup/lib/common.sh.
|
||||
PKG_FILE="setup/$pkgdir/packages.txt"
|
||||
SETUP_FILE="setup/$pkgdir/setup.sh"
|
||||
if ! [[ -f "$PKG_FILE" ]]; then
|
||||
say_fail "$PKG_FILE missing"
|
||||
continue
|
||||
@@ -99,12 +94,15 @@ for pkgdir in term basic utils hypr; do
|
||||
else
|
||||
say_fail "$PKG_FILE missing @pacman marker"
|
||||
fi
|
||||
# every @aur/@npm marker must be matched by a real consumer in setup.sh
|
||||
# every @aur/@npm marker must be matched by a real consumer: either the
|
||||
# thin setup.sh itself or the shared setup/lib/common.sh it sources.
|
||||
for marker in '@aur' '@npm'; do
|
||||
if grep -q "^$marker" "$PKG_FILE"; then
|
||||
grep -q "$marker" "$SETUP_FILE" \
|
||||
&& say_pass "$PKG_FILE $marker handled by $SETUP_FILE" \
|
||||
|| say_fail "$PKG_FILE uses $marker but $SETUP_FILE does not handle it"
|
||||
if grep -q "$marker" "$SETUP_FILE" || grep -q "$marker" "setup/lib/common.sh"; then
|
||||
say_pass "$PKG_FILE $marker handled by $SETUP_FILE (via common.sh)"
|
||||
else
|
||||
say_fail "$PKG_FILE uses $marker but neither $SETUP_FILE nor setup/lib/common.sh handles it"
|
||||
fi
|
||||
else
|
||||
say_pass "$PKG_FILE has no $marker section"
|
||||
fi
|
||||
@@ -112,12 +110,12 @@ for pkgdir in term basic utils hypr; do
|
||||
done
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 5. Makefile <-> install script name consistency.
|
||||
# Catches typos such as `_install_skripte_install_basic_pcks.sh`
|
||||
# 5. Makefile <-> setup script name consistency.
|
||||
# Catches typos such as `setup/basic/setuo.sh`
|
||||
# (missing '/') in Makefile targets.
|
||||
# ---------------------------------------------------------------------------
|
||||
echo "== Checking Makefile references install scripts that exist =="
|
||||
# Pull out every `*_install_*_pcks.sh` token mentioned in the Makefile.
|
||||
echo "== Checking Makefile references setup scripts that exist =="
|
||||
# Pull out every `setup/...sh` token mentioned in the Makefile.
|
||||
while IFS= read -r tok; do
|
||||
[[ -z "$tok" ]] && continue
|
||||
if [[ -e "$REPO_ROOT/$tok" ]]; then
|
||||
@@ -125,7 +123,7 @@ while IFS= read -r tok; do
|
||||
else
|
||||
say_fail "Makefile references missing script: $tok"
|
||||
fi
|
||||
done < <(grep -P '^\t' Makefile | grep -oE '[_A-Za-z0-9/-]*install_[A-Za-z0-9_-]*\.sh' | sort -u)
|
||||
done < <(grep -P '^\t' Makefile | grep -oE 'setup/[_A-Za-z0-9./-]+\.sh' | sort -u)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 6. Makefile <-> stow package name consistency.
|
||||
|
||||
Reference in New Issue
Block a user