Files
tidewall/tools/deb_check.sh
T
claudeandClaude Opus 5.5 f3161bf46c R2: Debian package, desktop entry, launcher and application icon
- make deb (tools/deb.sh) builds tidewall_<version>-1_amd64.deb with
  dpkg-deb: launchers in /usr/games, the game in /usr/lib/tidewall, a
  validated desktop entry, hicolor icons, man pages, a DEP-5 copyright,
  the engine's licences and md5sums. No maintainer scripts. Depends on
  libc6 (>= 2.28), from the binary's GLIBC symbol versions.
- make deb-check (tools/deb_check.sh) checks it in a throwaway debian:13
  container: apt install with no recommends, desktop-file-validate,
  icons, man pages and licences, tidewall on a user's PATH, the server
  and the game headless as a user, lintian, and a purge that leaves
  nothing behind.
- The tarball gains a tidewall launcher (any directory, through a
  symlink), install-desktop-entry.sh (per-user menu entry, --remove),
  tidewall.png and ENGINE-LICENSES.txt (Godot's MIT text and bundled
  notices, which R1 lacked). make dist-check covers the launcher and the
  menu entry.
- Application icon: a hand-written SVG in palette colours, rendered to
  16-512 px by make app-icon, and set as the window icon.
  test_app_icon checks the renders, the colours and the setting.
- Fix: looping ambience played into the Dummy audio driver could be
  reported as resources in use at exit. Directors play nothing without
  real audio output (SoundBank.has_output()) and stop their voices on
  exit.

Tests: make check (648), make dist-check, make deb-check all pass.

Closes #61

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:12:47 -05:00

90 lines
4.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# R2: builds the .deb (tools/deb.sh) and checks it in a throwaway Debian 13 container,
# never on this machine:
# - it installs with apt, with only its Depends (no recommended graphics libraries);
# - the desktop entry passes desktop-file-validate and its icons are in place;
# - the dedicated server runs a bot match headless as an ordinary user, from PATH;
# - the game itself starts headless, plays an offline match for a few seconds and
# reports that it played;
# - lintian, for information (its findings are printed, see docs/DEVLOG.md);
# - it purges cleanly: no file it installed is left behind.
#
# tools/deb_check.sh about 3 minutes, needs Docker and Debian's mirrors
set -uo pipefail
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo"
tools/deb.sh || { echo "deb-check FAIL: tools/deb.sh failed"; exit 1; }
deb="$(ls -t build/dist/tidewall_*_amd64.deb | head -n 1)"
name="tidewall-deb-check-$$"
cleanup() { docker rm -f "$name" >/dev/null 2>&1 || true; }
trap cleanup EXIT
docker run --rm --name "$name" --memory=3g --cpus=4 \
-v "$repo/$deb:/check/tidewall.deb:ro" debian:13 bash -c '
set -uo pipefail
status=0
fail() { echo "deb-check FAIL: $*"; status=1; }
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq >/dev/null || { echo "deb-check FAIL: apt-get update"; exit 1; }
apt-get install -y -qq --no-install-recommends desktop-file-utils lintian >/dev/null 2>&1 || { echo "deb-check FAIL: tools"; exit 1; }
echo "deb-check: install"
apt-get install -y -qq --no-install-recommends /check/tidewall.deb >/tmp/install.log 2>&1 || { tail -n 20 /tmp/install.log; echo "deb-check FAIL: install"; exit 1; }
dpkg -s tidewall | sed -n "s/^\(Status\|Version\): / \1: /p"
dpkg -L tidewall | sort >/tmp/files
echo "deb-check: desktop entry and icons"
desktop-file-validate /usr/share/applications/tidewall.desktop && echo " desktop-file-validate: ok" || fail "desktop-file-validate"
for side in 16 32 48 64 128 256; do
[ -s "/usr/share/icons/hicolor/${side}x${side}/apps/tidewall.png" ] || fail "no ${side}px icon"
done
[ -s /usr/share/icons/hicolor/scalable/apps/tidewall.svg ] || fail "no scalable icon"
[ -s /usr/share/doc/tidewall/copyright ] || fail "no copyright file"
zcat /usr/share/doc/tidewall/ENGINE-LICENSES.gz >/tmp/engine-licenses
grep -q "Permission is hereby granted" /tmp/engine-licenses || fail "no engine licence"
man_ok=1
for page in tidewall tidewall-server; do [ -s "/usr/share/man/man6/$page.6.gz" ] || man_ok=0; done
[ "$man_ok" -eq 1 ] || fail "manual pages missing"
useradd -m player
# A login shell, as the desktop has: its PATH has /usr/games, root'"'"'s does not.
exec_name="$(sed -n "s/^Exec=//p" /usr/share/applications/tidewall.desktop)"
su - player -c "command -v $exec_name" >/dev/null || fail "the entry runs $exec_name, which is not on a user'"'"'s PATH"
echo "deb-check: the server, headless, as a user"
su - player -c "tidewall-server --seed=2 --bots=24 --ticks=900 --unthrottled" >/tmp/server.log 2>&1
code=$?
[ "$code" -eq 0 ] || { tail -n 5 /tmp/server.log; fail "the server exited $code"; }
grep -q "\"event\":\"start\"" /tmp/server.log || fail "the server never started"
grep -q "\"errors\":0,\"event\":\"stop\"" /tmp/server.log || fail "the server logged errors"
grep -m1 "\"event\":\"stop\"" /tmp/server.log | cut -c1-160 | sed "s/^/ /"
echo "deb-check: the game, headless, an offline match"
su - player -c "tidewall --headless -- --offline --autoplay --client-seconds=15" >/tmp/game.log 2>&1
code=$?
report="$(grep -m1 "\"event\":\"client\"" /tmp/game.log || true)"
echo " ${report:0:200}"
[ "$code" -eq 0 ] || { tail -n 5 /tmp/game.log; fail "the game exited $code"; }
[ -n "$report" ] || fail "the game printed no report"
if grep -qE "^(ERROR|SCRIPT ERROR|WARNING: .*leaked)" /tmp/game.log; then grep -m3 -E "^(ERROR|SCRIPT ERROR|WARNING)" /tmp/game.log | sed "s/^/ /"; fail "the game logged errors"; fi
ls -d /home/player/.local/share/godot/app_userdata/Tidewall >/dev/null 2>&1 && echo " user data in ~/.local/share/godot/app_userdata/Tidewall"
echo "deb-check: lintian (for information)"
lintian --tag-display-limit 0 /check/tidewall.deb 2>&1 | sed "s/^/ /" || true
echo "deb-check: purge"
apt-get purge -y -qq tidewall >/tmp/purge.log 2>&1 || fail "purge"
dpkg -s tidewall >/dev/null 2>&1 && fail "still installed after purge"
left=0
while read -r path; do
case "$path" in /.|/|/usr|/usr/share/man|/usr/share/man/man6|/usr/games|/usr/lib|/usr/share|/usr/share/*/|/usr/share/applications|/usr/share/doc|/usr/share/icons|/usr/share/icons/hicolor|/usr/share/icons/hicolor/*/apps|/usr/share/icons/hicolor/*) [ -d "$path" ] && continue ;; esac
if [ -e "$path" ]; then echo " left behind: $path"; left=1; fi
done </tmp/files
[ "$left" -eq 0 ] && echo " nothing left behind" || fail "files left after purge"
exit $status
'
status=$?
[[ "$status" -eq 0 ]] && echo "deb-check: ok ($deb)" || echo "deb-check: FAILED"
exit "$status"