Check HamPack's Flatpaks can open serial ports, in hampackcheck

`hampackcheck packages` (and so the weekly `make check-packages`) now
asks Flathub's API for each Flatpak's permissions, and fails if its
devices don't include all, without which it can't see /dev/ttyUSB0 to
control a radio itself, or if Flathub can't say. WSJT-X and QLog both
have it.

radio configure doesn't need it: it points them at rigctld over the
network.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Young
2026-11-28 14:06:33 -07:00
co-authored by Claude Opus 5.5
parent 0c2f9b5316
commit c409a6cb17
5 changed files with 48 additions and 8 deletions
+17 -3
View File
@@ -14,6 +14,7 @@ COMPILE_CONF="${HAMPACK_COMPILE_CONF:-$HAMPACK_DIR/compile.conf}"
PACKAGES_CONF="${HAMPACK_PACKAGES_CONF:-$HAMPACK_DIR/packages.conf}"
AUR_RPC="https://aur.archlinux.org/rpc/v5/info"
FLATHUB_API="https://flathub.org/api/v2/appstream"
FLATHUB_SUMMARY="https://flathub.org/api/v2/summary"
# Fetch latest release tag via GitHub API, stripping leading "v"
github_latest() {
@@ -104,7 +105,8 @@ check_compiled() {
}
# Check that each package in packages.conf is in pacman's sync databases (as
# a package or a group) or on the AUR, and each Flatpak is on Flathub. Repo
# a package or a group) or on the AUR, and each Flatpak is on Flathub, with
# access to devices: they're radio programs, which open serial ports. Repo
# packages are looked up locally, so run `pacman -Sy` first for fresh results.
# A name that's only provided by another package still installs, but is
# reported so packages.conf can use the real name.
@@ -143,13 +145,25 @@ check_packages() {
done
fi
local devices
for p in "${flatpak_ids[@]}"; do
code="$(curl -s -o /dev/null -w '%{http_code}' "$FLATHUB_API/$p")"
case "$code" in
200) echo " $p is on Flathub" ;;
404) echo " $p is not on Flathub ** MISSING **"; status=1 ;;
*) echo " $p couldn't be checked: Flathub answered ${code:-nothing}"; status=1 ;;
404) echo " $p is not on Flathub ** MISSING **"; status=1; continue ;;
*) echo " $p couldn't be checked: Flathub answered ${code:-nothing}"; status=1; continue ;;
esac
# Without devices=all (its finish-args' --device=all), a Flatpak sees no
# /dev/ttyUSB0, so it can't control a radio itself
if ! devices="$(set -o pipefail; curl -sf "$FLATHUB_SUMMARY/$p" | jq -er '.metadata.permissions.devices // [] | join(",")')"; then
echo " $p's permissions couldn't be checked"
status=1
elif [[ ",$devices," == *,all,* ]]; then
echo " $p can open serial ports (devices=all)"
else
echo " $p can't open serial ports: its devices are \"${devices:-none}\", not all ** NO SERIAL PORTS **"
status=1
fi
done
return $status