From ec8a414185ad117325769f013702a8815abd0e18 Mon Sep 17 00:00:00 2001 From: cottongin Date: Wed, 18 Nov 2026 08:59:24 -0500 Subject: [PATCH] feat(packaging): add systemd user unit, APPLaunch entry, and arm64 deb builder --- .gitignore | 2 + packaging/Dockerfile.arm64 | 31 +++++ packaging/build-deb.sh | 151 +++++++++++++++++++++++++ packaging/cp0-sync.desktop | 8 ++ packaging/cp0-sync.png | Bin 0 -> 1359 bytes packaging/cp0-syncd.service | 15 +++ packaging/debian/control | 10 ++ packaging/debian/postinst | 18 +++ packaging/debian/prerm | 19 ++++ packaging/tests/test_packaging.py | 180 ++++++++++++++++++++++++++++++ 10 files changed, 434 insertions(+) create mode 100644 packaging/Dockerfile.arm64 create mode 100755 packaging/build-deb.sh create mode 100644 packaging/cp0-sync.desktop create mode 100644 packaging/cp0-sync.png create mode 100644 packaging/cp0-syncd.service create mode 100644 packaging/debian/control create mode 100755 packaging/debian/postinst create mode 100755 packaging/debian/prerm create mode 100644 packaging/tests/test_packaging.py diff --git a/.gitignore b/.gitignore index 4692209..27ab4e3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ __pycache__/ .pytest_cache/ build/ device-ui/build/ +device-ui/build-arm64/ device-ui/deps/ +packaging/dist/ *.deb .DS_Store diff --git a/packaging/Dockerfile.arm64 b/packaging/Dockerfile.arm64 new file mode 100644 index 0000000..2760d9e --- /dev/null +++ b/packaging/Dockerfile.arm64 @@ -0,0 +1,31 @@ +FROM --platform=linux/arm64 debian:bookworm-slim + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + pkg-config \ + libsqlite3-dev \ + libfreetype-dev \ + dpkg-dev \ + python3 \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY device-ui /app/device-ui +COPY device-daemon /app/device-daemon +COPY mac-receiver /app/mac-receiver +COPY packaging /app/packaging + +RUN rm -rf /app/device-ui/build /app/device-ui/build-arm64 \ + && cmake -S /app/device-ui -B /app/device-ui/build-arm64 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-O2" \ + -DCP0_UI_BUILD_APP=ON \ + -DCP0_UI_TARGET_DEVICE=ON \ + -DCP0_UI_BUILD_TESTS=ON \ + && cmake --build /app/device-ui/build-arm64 -j"$(nproc)" \ + && ctest --test-dir /app/device-ui/build-arm64 --output-on-failure \ + && /app/packaging/build-deb.sh --local --ui-bin /app/device-ui/build-arm64/cp0-sync-ui diff --git a/packaging/build-deb.sh b/packaging/build-deb.sh new file mode 100755 index 0000000..6b278c9 --- /dev/null +++ b/packaging/build-deb.sh @@ -0,0 +1,151 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" + +PKG_FILENAME="cp0-sync_1.0.0_m5stack1_arm64.deb" +OUT_DIR="${SCRIPT_DIR}/dist" +STAGE_ONLY_DIR="" +LOCAL_BUILD=0 +UI_BIN="" + +usage() { + cat < Stage .deb directory tree into and exit + --ui-bin Path to prebuilt cp0-sync-ui binary + --out-dir Output directory for .deb (default: packaging/dist) + -h, --help Show this help message +EOF +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --local) + LOCAL_BUILD=1 + shift + ;; + --stage-only) + [[ $# -ge 2 ]] || { echo "Missing argument for --stage-only" >&2; exit 2; } + STAGE_ONLY_DIR="$2" + shift 2 + ;; + --ui-bin) + [[ $# -ge 2 ]] || { echo "Missing argument for --ui-bin" >&2; exit 2; } + UI_BIN="$2" + shift 2 + ;; + --out-dir) + [[ $# -ge 2 ]] || { echo "Missing argument for --out-dir" >&2; exit 2; } + OUT_DIR="$2" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "Unknown option: $1" >&2 + usage >&2 + exit 2 + ;; + esac +done + +stage_package_tree() { + local stage_dir="$1" + local ui_bin="$2" + + rm -rf "${stage_dir}" + install -d "${stage_dir}/DEBIAN" + install -d "${stage_dir}/usr/bin" + install -d "${stage_dir}/usr/lib/cp0-sync/cp0_syncd" + install -d "${stage_dir}/usr/lib/systemd/user" + install -d "${stage_dir}/usr/share/APPLaunch/applications" + install -d "${stage_dir}/usr/share/APPLaunch/share/images" + + install -m 0644 "${SCRIPT_DIR}/debian/control" "${stage_dir}/DEBIAN/control" + install -m 0755 "${SCRIPT_DIR}/debian/postinst" "${stage_dir}/DEBIAN/postinst" + install -m 0755 "${SCRIPT_DIR}/debian/prerm" "${stage_dir}/DEBIAN/prerm" + + install -m 0755 "${ui_bin}" "${stage_dir}/usr/bin/cp0-sync-ui" + install -m 0755 "${ROOT_DIR}/device-daemon/bin/cp0-syncd" "${stage_dir}/usr/bin/cp0-syncd" + + while IFS= read -r -d '' py_file; do + local rel_path="${py_file#${ROOT_DIR}/device-daemon/cp0_syncd/}" + install -d "${stage_dir}/usr/lib/cp0-sync/cp0_syncd/$(dirname "${rel_path}")" + install -m 0644 "${py_file}" "${stage_dir}/usr/lib/cp0-sync/cp0_syncd/${rel_path}" + done < <(find "${ROOT_DIR}/device-daemon/cp0_syncd" -type f -name '*.py' -print0) + + install -m 0644 "${SCRIPT_DIR}/cp0-syncd.service" "${stage_dir}/usr/lib/systemd/user/cp0-syncd.service" + install -m 0644 "${SCRIPT_DIR}/cp0-sync.desktop" "${stage_dir}/usr/share/APPLaunch/applications/cp0-sync.desktop" + install -m 0644 "${SCRIPT_DIR}/cp0-sync.png" "${stage_dir}/usr/share/APPLaunch/share/images/cp0-sync.png" + + for font_dir in "${ROOT_DIR}/device-ui/assets/fonts" "${SCRIPT_DIR}/fonts"; do + if [[ -d "${font_dir}" ]]; then + while IFS= read -r -d '' font_file; do + install -d "${stage_dir}/usr/share/cp0-sync/fonts" + install -m 0644 "${font_file}" "${stage_dir}/usr/share/cp0-sync/fonts/$(basename "${font_file}")" + done < <(find "${font_dir}" -maxdepth 1 -type f \( -name '*.ttf' -o -name '*.otf' \) -print0) + fi + done +} + +resolve_ui_bin() { + if [[ -n "${UI_BIN}" ]]; then + [[ -f "${UI_BIN}" ]] || { echo "Specified --ui-bin not found: ${UI_BIN}" >&2; exit 1; } + echo "${UI_BIN}" + return + fi + for candidate in "${ROOT_DIR}/device-ui/build-arm64/cp0-sync-ui" "${ROOT_DIR}/device-ui/build/cp0-sync-ui"; do + if [[ -f "${candidate}" ]]; then + echo "${candidate}" + return + fi + done + echo "" +} + +if [[ -n "${STAGE_ONLY_DIR}" ]]; then + RESOLVED_UI="$(resolve_ui_bin)" + [[ -n "${RESOLVED_UI}" ]] || { echo "cp0-sync-ui binary not found; pass --ui-bin " >&2; exit 1; } + stage_package_tree "${STAGE_ONLY_DIR}" "${RESOLVED_UI}" + echo "Staged package tree at ${STAGE_ONLY_DIR}" + exit 0 +fi + +if [[ "${LOCAL_BUILD}" -eq 1 ]]; then + if [[ -z "${UI_BIN}" ]]; then + BUILD_DIR="${ROOT_DIR}/device-ui/build-arm64" + cmake -S "${ROOT_DIR}/device-ui" -B "${BUILD_DIR}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-O2" \ + -DCP0_UI_BUILD_APP=ON \ + -DCP0_UI_TARGET_DEVICE=ON \ + -DCP0_UI_BUILD_TESTS=ON + cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 2)" + ctest --test-dir "${BUILD_DIR}" --output-on-failure + UI_BIN="${BUILD_DIR}/cp0-sync-ui" + fi + + TMP_STAGE="$(mktemp -d)" + trap 'rm -rf "${TMP_STAGE}"' EXIT + stage_package_tree "${TMP_STAGE}/pkg" "${UI_BIN}" + + mkdir -p "${OUT_DIR}" + dpkg-deb --build --root-owner-group "${TMP_STAGE}/pkg" "${OUT_DIR}/${PKG_FILENAME}" + echo "Built ${OUT_DIR}/${PKG_FILENAME}" + exit 0 +fi + +# Default: build inside linux/arm64 Debian Bookworm Docker container +IMAGE_TAG="cp0-sync-deb-builder:arm64" +docker build --platform linux/arm64 -f "${SCRIPT_DIR}/Dockerfile.arm64" -t "${IMAGE_TAG}" "${ROOT_DIR}" + +mkdir -p "${OUT_DIR}" +CONTAINER_ID="$(docker create --platform linux/arm64 "${IMAGE_TAG}")" +trap 'docker rm -f "${CONTAINER_ID}" >/dev/null 2>&1 || true' EXIT +docker cp "${CONTAINER_ID}:/app/packaging/dist/${PKG_FILENAME}" "${OUT_DIR}/${PKG_FILENAME}" +echo "Built ${OUT_DIR}/${PKG_FILENAME}" diff --git a/packaging/cp0-sync.desktop b/packaging/cp0-sync.desktop new file mode 100644 index 0000000..fb7ce2d --- /dev/null +++ b/packaging/cp0-sync.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Photo Sync +Comment=Automatic photo sync to Mac over Tailscale +Exec=/usr/bin/cp0-sync-ui +Icon=/usr/share/APPLaunch/share/images/cp0-sync.png +Terminal=false +Categories=Utility;Network; diff --git a/packaging/cp0-sync.png b/packaging/cp0-sync.png new file mode 100644 index 0000000000000000000000000000000000000000..5bec6b9065852c0982857038c6f94c2538291dba GIT binary patch literal 1359 zcmV-V1+e;wP)I(9LKww|NoWw2vamE>e3TCbgDEwRHx_#R+pgEQ=w5J85jiy+QI6eT|5~b%X?TR zK~fQf*dMb?2MOv$WeJaIzthgXdHZ(PUETNI{`n1jVcDIXo%y`qZ+N|Y#3 zqU0zwHtuXyG^A)+(UPKsBIYwC)VfcrZE4L0xK2fLsKEB^J6KIk9g9S^vZ|_xqH3Qh z!t0JUpe-s?w5>A};G*g;#UEH+zKLzzSith~@&h5X1#LpxRFG(E)Gc^1n0tMFBY#Lx zpqUA6L|auCkGTPl|1t#yMS+JWgtki77+a6qCQwk2+|`L&s}K`wa%c1dFy$~=o{=T0 z?mWGgXd8+?&rYAHx^kxzfO9b4u)`BlU3t#QAepSs*a}DZT*4HGprr~-z{U>11m=kZEmdFwHg*8=$u>dL1FYtOga8u2kOADYr-@BX zJz*;=E3OD-q0G<#bQ7KoF*E?(h9^V-2_OL^fCMmL01qEN%KG}Quz`UAO$!SPuERr_ z@-y^89Z(nF0BmmF%VuU~GG=XS73ze#c^Y6%O)XnoT=X0~A=C|Z^en*Jx9@lso)GHj zS%6-)KG_OA3()KE+=|+s1~@TspS8E2R4TZGzl()%jB~g~08KPGImw!unpb@W@*pn( zlr%hiE3K^j{6bb(Si*&4{dL?!02Pgm-AgH>sHl`xR#vJ1GfWESa81sOdqWLyettgX z|2Ac16=~q~LLT}5Dkvkg06RK5wR=lS%F|%g);4hI&m*t64`qZBU_2hztPg#h3@94i z%li9ou<`K+TsX!#IgjWUQ3lEi9Y91qs1H=i zx_r4e1>BZv`&r$y)3$`XPCy1O3itF}O#T7#*slMUW)q$!L!F{{E}lu|8n5z3gR2USH9KXT19Mp56cQmUh(5Ze9xEYAx|G;(LNfD(w8N@Bo_0kOW}Uw(bH z1yEQb@}N)DUqjh}e65M;ns_FkVdxtEefbBA|M|(S3qqf06?KsZfkl5FWe4)by1b%d z6n){62o`pSEy#;|jG}QM|Jo5~fL4Dla!cLa-Igv4cZ6G7L4#Wh7l*sU?Q`zJIr(bH zAc!C!z)}$)%m9k%vgQ4nQM|&H6AV7cv@1Ll_(jFh-VW z2Vm9*(z%k^+8-do63wP^@^nu>)NyMn=ZlXGtripD&Sr}VR%?USiwX8WHuTNsuGw79 za`L&WuRgfW)`F^&53YUp$$zGo^qqe4@5@amGWk-;(WVoA-}WREuQeTQdqNxUxUlgK zZT+;)t)FP~F&8!;qwVk3x&0k&!05sTjI;$PZ9?mfO=xKwWJ;7MQKDp&{sEhl{!*tg R>pK7d002ovPDHLkV1h`hedz!I literal 0 HcmV?d00001 diff --git a/packaging/cp0-syncd.service b/packaging/cp0-syncd.service new file mode 100644 index 0000000..a6e4432 --- /dev/null +++ b/packaging/cp0-syncd.service @@ -0,0 +1,15 @@ +[Unit] +Description=CardputerZero Photo Sync Background Daemon +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/bin/cp0-syncd +Restart=on-failure +RestartSec=5 +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=default.target diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 0000000..f2b9566 --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,10 @@ +Package: cp0-sync +Version: 1.0.0-m5stack1 +Section: utils +Priority: optional +Architecture: arm64 +Maintainer: CardputerZero Sync +Depends: python3 (>= 3.9), libsqlite3-0, libfreetype6 +Description: Automatic one-way photo sync daemon and LVGL companion UI for CardputerZero + Background systemd user daemon (cp0-syncd) and 320x170 companion UI + (cp0-sync-ui) for syncing photos over Tailscale to a Mac receiver. diff --git a/packaging/debian/postinst b/packaging/debian/postinst new file mode 100755 index 0000000..2961506 --- /dev/null +++ b/packaging/debian/postinst @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +if [ "$1" = "configure" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl --global enable cp0-syncd.service || true + + if command -v loginctl >/dev/null 2>&1; then + for user_entry in $(loginctl list-users --no-legend 2>/dev/null | awk '{print $2}'); do + [ -n "$user_entry" ] || continue + systemctl --machine="${user_entry}@.host" --user daemon-reload >/dev/null 2>&1 || true + systemctl --machine="${user_entry}@.host" --user restart cp0-syncd.service >/dev/null 2>&1 || true + done + fi + fi +fi + +exit 0 diff --git a/packaging/debian/prerm b/packaging/debian/prerm new file mode 100755 index 0000000..b97dcd7 --- /dev/null +++ b/packaging/debian/prerm @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +case "$1" in + remove|deconfigure) + if command -v systemctl >/dev/null 2>&1; then + if command -v loginctl >/dev/null 2>&1; then + for user_entry in $(loginctl list-users --no-legend 2>/dev/null | awk '{print $2}'); do + [ -n "$user_entry" ] || continue + systemctl --machine="${user_entry}@.host" --user stop cp0-syncd.service >/dev/null 2>&1 || true + done + fi + systemctl --global disable cp0-syncd.service >/dev/null 2>&1 || true + fi + rm -rf /usr/lib/cp0-sync/cp0_syncd/__pycache__ + ;; +esac + +exit 0 diff --git a/packaging/tests/test_packaging.py b/packaging/tests/test_packaging.py new file mode 100644 index 0000000..e5582c8 --- /dev/null +++ b/packaging/tests/test_packaging.py @@ -0,0 +1,180 @@ +import os +import stat +import struct +import subprocess +import tempfile +import unittest +import zlib +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +PACKAGING_DIR = ROOT / "packaging" + + +def _parse_png_chunks(data: bytes) -> list[tuple[bytes, bytes]]: + if data[:8] != b"\x89PNG\r\n\x1a\n": + raise ValueError("Invalid PNG signature") + pos = 8 + chunks: list[tuple[bytes, bytes]] = [] + while pos + 12 <= len(data): + length = struct.unpack(">I", data[pos : pos + 4])[0] + chunk_type = data[pos + 4 : pos + 8] + chunk_data = data[pos + 8 : pos + 8 + length] + crc_expected = struct.unpack(">I", data[pos + 8 + length : pos + 12 + length])[0] + crc_actual = zlib.crc32(chunk_type + chunk_data) & 0xFFFFFFFF + if crc_expected != crc_actual: + raise ValueError(f"CRC mismatch in chunk {chunk_type!r}") + chunks.append((chunk_type, chunk_data)) + pos += 12 + length + if chunk_type == b"IEND": + break + return chunks + + +class TestPackagingAssets(unittest.TestCase): + def test_systemd_user_unit(self) -> None: + unit = (PACKAGING_DIR / "cp0-syncd.service").read_text(encoding="utf-8") + self.assertIn("ExecStart=/usr/bin/cp0-syncd", unit) + self.assertIn("WantedBy=default.target", unit) + self.assertIn("Restart=on-failure", unit) + self.assertIn("RestartSec=5", unit) + self.assertIn("After=network-online.target", unit) + + def test_desktop_entry(self) -> None: + desktop = (PACKAGING_DIR / "cp0-sync.desktop").read_text(encoding="utf-8") + self.assertIn("Type=Application", desktop) + self.assertIn("Name=Photo Sync", desktop) + self.assertIn("Exec=/usr/bin/cp0-sync-ui", desktop) + self.assertIn("Icon=/usr/share/APPLaunch/share/images/cp0-sync.png", desktop) + self.assertIn("Terminal=false", desktop) + + def test_icon_png_valid_80x80(self) -> None: + png = (PACKAGING_DIR / "cp0-sync.png").read_bytes() + self.assertEqual(png[:8], b"\x89PNG\r\n\x1a\n") + width, height = struct.unpack(">II", png[16:24]) + self.assertEqual(width, 80) + self.assertEqual(height, 80) + + chunks = _parse_png_chunks(png) + chunk_types = [t for t, _ in chunks] + self.assertIn(b"IHDR", chunk_types) + self.assertIn(b"IDAT", chunk_types) + self.assertEqual(chunk_types[-1], b"IEND") + + idat_payload = b"".join(d for t, d in chunks if t == b"IDAT") + raw_pixels = zlib.decompress(idat_payload) + # 80 rows * (1 filter byte + 80 * 4 RGBA bytes) = 25680 bytes (or RGB = 19280) + self.assertGreaterEqual(len(raw_pixels), 80 * (1 + 80 * 3)) + + def test_debian_control(self) -> None: + ctrl = (PACKAGING_DIR / "debian" / "control").read_text(encoding="utf-8") + self.assertIn("Package: cp0-sync", ctrl) + self.assertIn("Version: 1.0.0-m5stack1", ctrl) + self.assertIn("Architecture: arm64", ctrl) + self.assertIn("Depends:", ctrl) + self.assertIn("python3 (>= 3.9)", ctrl) + self.assertIn("libsqlite3-0", ctrl) + self.assertIn("libfreetype6", ctrl) + self.assertNotIn("${", ctrl) + + def test_maintainer_scripts(self) -> None: + postinst_path = PACKAGING_DIR / "debian" / "postinst" + prerm_path = PACKAGING_DIR / "debian" / "prerm" + + for script_path in (postinst_path, prerm_path): + mode = script_path.stat().st_mode + self.assertEqual(stat.S_IMODE(mode) & 0o755, 0o755, f"{script_path} must be executable") + text = script_path.read_text(encoding="utf-8") + self.assertIn("set -e", text) + + postinst = postinst_path.read_text(encoding="utf-8") + self.assertIn("systemctl --global enable cp0-syncd.service", postinst) + self.assertIn("|| true", postinst) + + prerm = prerm_path.read_text(encoding="utf-8") + self.assertIn("systemctl --global disable cp0-syncd.service", prerm) + self.assertIn("|| true", prerm) + + def test_build_deb_script_and_stage_only(self) -> None: + build_script = PACKAGING_DIR / "build-deb.sh" + mode = build_script.stat().st_mode + self.assertEqual(stat.S_IMODE(mode) & 0o755, 0o755, "build-deb.sh must be executable") + + syntax = subprocess.run( + ["bash", "-n", str(build_script)], + capture_output=True, + text=True, + check=False, + ) + self.assertEqual(syntax.returncode, 0, f"bash -n failed: {syntax.stderr}") + + script_text = build_script.read_text(encoding="utf-8") + self.assertIn("cp0-sync_1.0.0_m5stack1_arm64.deb", script_text) + + with tempfile.TemporaryDirectory() as tmp: + tmp_path = Path(tmp) + dummy_ui = tmp_path / "cp0-sync-ui" + dummy_ui.write_bytes(b"#!/bin/sh\nexit 0\n") + dummy_ui.chmod(0o755) + + stage_dir = tmp_path / "stage" + res = subprocess.run( + [str(build_script), "--stage-only", str(stage_dir), "--ui-bin", str(dummy_ui)], + capture_output=True, + text=True, + check=False, + ) + self.assertEqual(res.returncode, 0, f"--stage-only failed:\nSTDOUT:\n{res.stdout}\nSTDERR:\n{res.stderr}") + + expected_files = [ + stage_dir / "DEBIAN" / "control", + stage_dir / "DEBIAN" / "postinst", + stage_dir / "DEBIAN" / "prerm", + stage_dir / "usr" / "bin" / "cp0-sync-ui", + stage_dir / "usr" / "bin" / "cp0-syncd", + stage_dir / "usr" / "lib" / "cp0-sync" / "cp0_syncd" / "__init__.py", + stage_dir / "usr" / "lib" / "cp0-sync" / "cp0_syncd" / "daemon.py", + stage_dir / "usr" / "lib" / "systemd" / "user" / "cp0-syncd.service", + stage_dir / "usr" / "share" / "APPLaunch" / "applications" / "cp0-sync.desktop", + stage_dir / "usr" / "share" / "APPLaunch" / "share" / "images" / "cp0-sync.png", + ] + for fpath in expected_files: + self.assertTrue(fpath.is_file(), f"Missing staged file: {fpath}") + + for exec_path in ( + stage_dir / "DEBIAN" / "postinst", + stage_dir / "DEBIAN" / "prerm", + stage_dir / "usr" / "bin" / "cp0-sync-ui", + stage_dir / "usr" / "bin" / "cp0-syncd", + ): + self.assertEqual( + stat.S_IMODE(exec_path.stat().st_mode), + 0o755, + f"Expected 0755 on {exec_path}", + ) + + pycache_dirs = list((stage_dir / "usr" / "lib" / "cp0-sync").rglob("__pycache__")) + self.assertEqual(pycache_dirs, [], "Staged Python tree must not contain __pycache__") + + def test_dockerfile_arm64(self) -> None: + dockerfile = (PACKAGING_DIR / "Dockerfile.arm64").read_text(encoding="utf-8") + self.assertIn("debian:bookworm-slim", dockerfile) + for pkg in ( + "build-essential", + "cmake", + "pkg-config", + "libsqlite3-dev", + "libfreetype-dev", + "dpkg-dev", + "python3", + ): + self.assertIn(pkg, dockerfile) + self.assertIn("-DCP0_UI_BUILD_APP=ON", dockerfile) + self.assertIn("-DCP0_UI_TARGET_DEVICE=ON", dockerfile) + self.assertIn("-DCP0_UI_BUILD_TESTS=ON", dockerfile) + self.assertIn("ctest", dockerfile) + self.assertIn("build-deb.sh --local", dockerfile) + + +if __name__ == "__main__": + unittest.main()