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:
co-authored by
Claude Opus 5.5
parent
0c2f9b5316
commit
c409a6cb17
+28
-1
@@ -31,6 +31,10 @@ setup() {
|
||||
esac
|
||||
done
|
||||
echo "]}" ;;
|
||||
https://flathub.org/api/v2/summary/*)
|
||||
f="$FAKE_NET/summary-${url##*/}"
|
||||
[ -f "$f" ] || exit 22
|
||||
cat "$f" ;;
|
||||
https://flathub.org/*)
|
||||
grep -qxF "${url##*/}" "$FAKE_NET/flathub" 2>/dev/null && echo 200 || echo 404 ;;
|
||||
*)
|
||||
@@ -55,6 +59,14 @@ setup() {
|
||||
esac'
|
||||
}
|
||||
|
||||
# A Flatpak on Flathub, with these devices: flathub_app ID [DEVICES...]
|
||||
flathub_app() {
|
||||
local id="$1"
|
||||
shift
|
||||
echo "$id" >> "$FAKE_NET/flathub"
|
||||
jq -n --args '{metadata: {permissions: {devices: $ARGS.positional, shared: ["network"]}}}' "$@" > "$FAKE_NET/summary-$id"
|
||||
}
|
||||
|
||||
tags() { local repo="$1"; shift; printf 'abc\trefs/tags/%s\n' "$@" > "$FAKE_NET/tags-$repo"; }
|
||||
|
||||
packages_conf() {
|
||||
@@ -166,9 +178,10 @@ EOF
|
||||
echo repo-pkg > "$FAKE_NET/repo"
|
||||
echo a-group > "$FAKE_NET/groups"
|
||||
echo aur-pkg > "$FAKE_NET/aur"
|
||||
echo org.example.App > "$FAKE_NET/flathub"
|
||||
flathub_app org.example.App all
|
||||
run "$REPO/hampackcheck" packages
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"org.example.App can open serial ports (devices=all)"* ]]
|
||||
[[ "$output" == *"3 packages, 2 in the repos"* ]]
|
||||
[[ "$output" == *"aur-pkg is on the AUR"* ]]
|
||||
[[ "$output" == *"org.example.App is on Flathub"* ]]
|
||||
@@ -187,6 +200,20 @@ EOF
|
||||
[[ "$output" != *"repo-pkg is"* ]]
|
||||
}
|
||||
|
||||
@test "hampackcheck: a Flatpak that can't open serial ports fails the check" {
|
||||
packages_conf "" "" "org.example.Dri
|
||||
org.example.None
|
||||
org.example.Unknown"
|
||||
flathub_app org.example.Dri dri
|
||||
flathub_app org.example.None
|
||||
echo org.example.Unknown >> "$FAKE_NET/flathub"
|
||||
run "$REPO/hampackcheck" packages
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"org.example.Dri can't open serial ports: its devices are \"dri\", not all ** NO SERIAL PORTS **"* ]]
|
||||
[[ "$output" == *"org.example.None can't open serial ports: its devices are \"none\", not all"* ]]
|
||||
[[ "$output" == *"org.example.Unknown's permissions couldn't be checked"* ]]
|
||||
}
|
||||
|
||||
@test "hampackcheck: a name only provided by another package passes, with a note" {
|
||||
packages_conf "old-name" "" ""
|
||||
echo "old-name=new-name" > "$FAKE_NET/provides"
|
||||
|
||||
Reference in New Issue
Block a user