Compile WebKit GSettings schemas for clean rootfs builds

The live nokia-beatles target exposed two gaps: the phone was still running the baseline webarchy.so/networks.so binaries, and WebKit's network process aborted because apk --no-scripts left gschemas.compiled ungenerated. Deploy the current plugin binaries on the phone and make clean image builds compile the schema database from explicit glib/gsettings-desktop-schemas packages. Add a host test and build guards; live HTTP rendering and Bluetooth discovery now pass.
This commit is contained in:
Luxferre committed 2026-11-10 15:47:03 +02:00
1 parent a7b1a75465
commit f892531df6
11 files changed
+174 -7

No files matched your search

+1
View File
@@ -463,4 +463,5 @@ chown -R 10000:10000 "$TARGET_ROOTFS/home/user/.ssh" 2>/dev/null || true
chown -R 0:0 "$TARGET_ROOTFS/etc/skel/.ssh" "$TARGET_ROOTFS/root/.ssh" \
2>/dev/null || true
"$BASE_DIR/scripts/compile-gsettings-schemas.sh" "$TARGET_ROOTFS"
echo "Bananarchy overlay applied to $TARGET_ROOTFS for device $DEVICE."
+1 -1
View File
@@ -33,7 +33,7 @@ cp /etc/apk/repositories "$ROOTFS/etc/apk/repositories"
cp "$REPO"/keys/*.rsa.pub "$ROOTFS/etc/apk/keys/"
echo "[2/8] Installing host helper tools..."
apk add --no-cache python3 kmod openssl >/dev/null
apk add --no-cache python3 kmod openssl glib >/dev/null
echo "[3/8] Installing the Bananarchy armv7 package set..."
PKGS="$(grep -v '^[[:space:]]*#' "$PKGS_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')"
+18
View File
@@ -1137,6 +1137,24 @@ if command -v g++ >/dev/null 2>&1 && \
fail "host webarchy renderer profile test failed"
fi
echo "[check] Webarchy GSettings schemas..."
GS_SCHEMA_COMPILER="$BASE_DIR/scripts/compile-gsettings-schemas.sh"
if [ ! -x "$GS_SCHEMA_COMPILER" ]; then
fail "missing or non-executable scripts/compile-gsettings-schemas.sh"
fi
if ! command -v glib-compile-schemas >/dev/null 2>&1; then
fail "glib-compile-schemas is required to build WebKitGTK rootfs images"
fi
if ! command -v gsettings >/dev/null 2>&1; then
fail "gsettings is required to verify compiled WebKitGTK schemas"
fi
if [ ! -x "$BASE_DIR/scripts/test-webkit-gsettings.py" ]; then
fail "missing host unit test scripts/test-webkit-gsettings.py"
fi
if ! "$BASE_DIR/scripts/test-webkit-gsettings.py" >/dev/null 2>&1; then
fail "host WebKit GSettings schema test failed"
fi
echo "[check] Idle blank screenlock wiring..."
IDLE_BLANK="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-idle-blank.sh"
IDLE_LOCK="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-idle-lock.sh"
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
# Compile the target rootfs's GSettings XML schemas.
# Apk installs packages with --no-scripts, so gschemas.compiled is not created
# by package triggers. WebKitGTK's network process aborts when the compiled
# schema database is missing, producing an "Unexpected WebKit error".
set -eu
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
TARGET_ROOTFS="${1:-${ROOTFS_DIR:-$BASE_DIR/rootfs}}"
SCHEMA_DIR="$TARGET_ROOTFS/usr/share/glib-2.0/schemas"
if [ ! -d "$SCHEMA_DIR" ]; then
echo "Error: GSettings schema directory is missing: $SCHEMA_DIR" >&2
exit 1
fi
schema_found=0
for schema_file in "$SCHEMA_DIR"/*.gschema.xml "$SCHEMA_DIR"/*.enums.xml; do
if [ -f "$schema_file" ]; then
schema_found=1
break
fi
done
if [ "$schema_found" -ne 1 ]; then
echo "Error: no GSettings schema XML files found in $SCHEMA_DIR" >&2
exit 1
fi
if ! command -v glib-compile-schemas >/dev/null 2>&1; then
echo "Error: glib-compile-schemas is required to compile $SCHEMA_DIR" >&2
exit 1
fi
glib-compile-schemas --strict --targetdir="$SCHEMA_DIR" "$SCHEMA_DIR" >/dev/null
if [ ! -s "$SCHEMA_DIR/gschemas.compiled" ]; then
echo "Error: glib-compile-schemas did not create gschemas.compiled" >&2
exit 1
fi
chmod 0644 "$SCHEMA_DIR/gschemas.compiled"
echo "[ok] compiled GSettings schemas in $SCHEMA_DIR"
+2
View File
@@ -30,6 +30,8 @@ font-noto
font-noto-emoji
frotz
git
glib
gsettings-desktop-schemas
gst-libav
gst-plugins-bad
gst-plugins-good
+96
View File
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
"""Host test for the WebKitGTK GSettings schema build wiring.
The live WebKitNetworkProcess aborts with "No GSettings schemas are installed
on the system" when the rootfs contains schema XML but no gschemas.compiled.
This test guards the package/build wiring and compiles a synthetic schema with
the same helper used by apply-bananarchy-overlay.sh.
"""
import os
import pathlib
import shutil
import subprocess
import sys
import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent
HELPER = BASE / "scripts/compile-gsettings-schemas.sh"
PACKAGES = BASE / "scripts/rootfs-packages.txt"
OVERLAY = BASE / "scripts/apply-bananarchy-overlay.sh"
BOOTSTRAP = BASE / "scripts/bootstrap-rootfs-container.sh"
REBUILD = BASE / "rebuild-image.sh"
SCHEMA_XML = """<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="org.bananarchy.webkit.probe" path="/org/bananarchy/webkit/probe/">
<key name="enabled" type="b">
<default>true</default>
</key>
</schema>
</schemalist>
"""
def read(path):
return path.read_text(encoding="utf-8")
def main():
for tool in ("glib-compile-schemas", "gsettings"):
if not shutil.which(tool):
raise SystemExit("missing required host tool: %s" % tool)
if not HELPER.is_file() or not os.access(HELPER, os.X_OK):
raise SystemExit("missing executable scripts/compile-gsettings-schemas.sh")
helper = read(HELPER)
if "glib-compile-schemas --strict --targetdir" not in helper:
raise SystemExit("compile helper lost its strict targetdir compilation")
if "gschemas.compiled" not in helper:
raise SystemExit("compile helper no longer validates gschemas.compiled")
packages = {
line.strip()
for line in read(PACKAGES).splitlines()
if line.strip() and not line.lstrip().startswith("#")
}
for package in ("glib", "gsettings-desktop-schemas"):
if package not in packages:
raise SystemExit("rootfs package set is missing %s" % package)
overlay = read(OVERLAY)
if "scripts/compile-gsettings-schemas.sh" not in overlay:
raise SystemExit("overlay application no longer compiles GSettings schemas")
bootstrap = read(BOOTSTRAP)
if "apk add --no-cache python3 kmod openssl glib" not in bootstrap:
raise SystemExit("bootstrap container no longer installs glib host tools")
rebuild = read(REBUILD)
if " glib \\\n" not in rebuild:
raise SystemExit("image build container no longer installs glib host tools")
print("[ok] WebKit GSettings package and build wiring")
with tempfile.TemporaryDirectory(prefix="bananarchy-gsettings-") as tmp:
root = pathlib.Path(tmp)
schema_dir = root / "usr/share/glib-2.0/schemas"
schema_dir.mkdir(parents=True)
(schema_dir / "org.bananarchy.webkit.probe.gschema.xml").write_text(
SCHEMA_XML, encoding="utf-8")
result = subprocess.run(
[str(HELPER), str(root)], capture_output=True, text=True)
if result.returncode != 0:
raise SystemExit("schema compile failed:\n%s" % result.stderr.strip())
compiled = schema_dir / "gschemas.compiled"
if not compiled.is_file() or compiled.stat().st_size == 0:
raise SystemExit("helper did not produce gschemas.compiled")
env = os.environ.copy()
env["GSETTINGS_SCHEMA_DIR"] = str(schema_dir)
listed = subprocess.run(
["gsettings", "list-schemas"], env=env,
capture_output=True, text=True)
if listed.returncode != 0 or \
"org.bananarchy.webkit.probe" not in listed.stdout:
raise SystemExit("compiled schema database is not readable by gsettings")
print("[ok] WebKit GSettings schema compilation")
if __name__ == "__main__":
main()