basic and utils: overhaul set-up
This commit is contained in:
+20
-17
@@ -129,23 +129,26 @@ NOOP
|
||||
chmod +x "$HOME/bin/"*
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
|
||||
# 2c. term/setup.sh package parsing sanity (mirrors read_packages).
|
||||
if ( cd "$REPO" && bash -n term/setup.sh ); then
|
||||
say_ok "term/setup.sh syntax OK"
|
||||
else
|
||||
say_fail "term/setup.sh syntax error"
|
||||
fi
|
||||
pacman_count=$(awk '
|
||||
/^@pacman/{s="pacman"}
|
||||
/^@aur/{s="aur"}
|
||||
/^@npm/{s="npm"}
|
||||
/^[[:space:]]*#/{next}
|
||||
/^[[:space:]]*$/{next}
|
||||
s=="pacman"{pc++} s=="aur"{ac++} s=="npm"{nc++}
|
||||
END{printf "%d %d %d", pc,ac,nc}
|
||||
' $REPO/term/packages.txt)
|
||||
read -r PC AC NC <<< "$pacman_count"
|
||||
say_ok "packages.txt -> ${PC} pacman, ${AC} aur, ${NC} npm entries"
|
||||
# 2c. setup.sh package parsing sanity (mirrors read_packages) for each
|
||||
# package dir: basic/term/utils.
|
||||
for d in basic term utils; do
|
||||
if ( cd "$REPO" && bash -n "$d/setup.sh" ); then
|
||||
say_ok "$d/setup.sh syntax OK"
|
||||
else
|
||||
say_fail "$d/setup.sh syntax error"
|
||||
fi
|
||||
pacman_count=$(awk '
|
||||
/^@pacman/{s="pacman"}
|
||||
/^@aur/{s="aur"}
|
||||
/^@npm/{s="npm"}
|
||||
/^[[:space:]]*#/{next}
|
||||
/^[[:space:]]*$/{next}
|
||||
s=="pacman"{pc++} s=="aur"{ac++} s=="npm"{nc++}
|
||||
END{printf "%d %d %d", pc,ac,nc}
|
||||
' "$REPO/$d/packages.txt")
|
||||
read -r PC AC NC <<< "$pacman_count"
|
||||
say_ok "$d/packages.txt -> ${PC} pacman, ${AC} aur, ${NC} npm entries"
|
||||
done
|
||||
|
||||
# 2d. If network allowed and not skipped, actually install the pacman
|
||||
# section of term/setup.sh (mirrors `make term` without AUR/npm).
|
||||
|
||||
+21
-15
@@ -70,23 +70,29 @@ else
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 4. packages.txt parsing sanity (mirrors term/setup.sh read_packages).
|
||||
# 4. packages.txt parsing sanity (mirrors each setup.sh read_packages).
|
||||
# ---------------------------------------------------------------------------
|
||||
echo "== Checking term/packages.txt markers =="
|
||||
if grep -q '^@pacman' term/packages.txt; then
|
||||
say_pass "packages.txt declares @pacman section"
|
||||
else
|
||||
say_fail "packages.txt missing @pacman marker"
|
||||
fi
|
||||
# every @aur/@npm marker must be matched by a real consumer in setup.sh
|
||||
for marker in '@aur' '@npm'; do
|
||||
if grep -q "^$marker" term/packages.txt; then
|
||||
grep -q "$marker" term/setup.sh \
|
||||
&& say_pass "packages.txt $marker handled by term/setup.sh" \
|
||||
|| say_fail "packages.txt uses $marker but term/setup.sh does not handle it"
|
||||
else
|
||||
say_pass "packages.txt has no $marker section"
|
||||
echo "== Checking packages.txt markers =="
|
||||
for pkgdir in term basic utils; do
|
||||
if ! [[ -f "$pkgdir/packages.txt" ]]; then
|
||||
say_fail "$pkgdir/packages.txt missing"
|
||||
continue
|
||||
fi
|
||||
if grep -q '^@pacman' "$pkgdir/packages.txt"; then
|
||||
say_pass "$pkgdir/packages.txt declares @pacman section"
|
||||
else
|
||||
say_fail "$pkgdir/packages.txt missing @pacman marker"
|
||||
fi
|
||||
# every @aur/@npm marker must be matched by a real consumer in setup.sh
|
||||
for marker in '@aur' '@npm'; do
|
||||
if grep -q "^$marker" "$pkgdir/packages.txt"; then
|
||||
grep -q "$marker" "$pkgdir/setup.sh" \
|
||||
&& say_pass "$pkgdir/packages.txt $marker handled by $pkgdir/setup.sh" \
|
||||
|| say_fail "$pkgdir/packages.txt uses $marker but $pkgdir/setup.sh does not handle it"
|
||||
else
|
||||
say_pass "$pkgdir/packages.txt has no $marker section"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user