Skip to content

ci: Assemble the AppImage AppDir from Python (#962) - #2600

Merged
zackees merged 2 commits into
masterfrom
infra/962-gen-005-assemble-appdir
Oct 27, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/962-gen-005-assemble-appdir

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

build-aux/appimage/assemble-appdir.sh (306 lines of bash) becomes
build-aux/appimage/assemble_appdir.py. Every branch, message and exit code is
preserved: the usage/compatibility-library audit failures still exit 2, the
Qt-plugin, gconv/PipeWire and loader failures still exit 1, and every
::error:: diagnostic still goes to stderr. No shell left; the subprocess
helpers the script ran are still invoked through uv run
(uv run --no-project for hostlib/build.py and set_runpaths.py,
uv run --script for check-glibc-floor.py).

Refs #962.

RED

Commit eb80156 — test(ci): drive the AppDir assembly from Python instead of the shell script (#962)

ci/test_assemble_appdir.py drives the port's decisions over a fake AppDir with
stub executables (readelf, gcc, qtpaths6, pkg-config, ldd, patchelf,
dpkg-query, getconf, install) placed first on PATH. With the module
absent (relocated, so the failures are attributable to the missing port and not
to test bugs):

$ uv run --no-project python -m unittest ci/test_assemble_appdir.py
Ran 12 tests ... FAILED (errors=9, failures=3)

The three wiring tests failed too: the shell script was still present,
build.py still ran it, and ci.toml still carried the GEN-005 exception.

GREEN

Commit 8294c75 — ci: Assemble the AppImage AppDir from Python (#962)

$ uv run --no-project python -m unittest ci.test_assemble_appdir
Ran 12 tests in 0.517s
OK

$ uv run --no-project python -m unittest ci.test_assemble_appdir ci.test_set_runpaths \
    ci.test_appimage_host_stack ci.test_glibc_floor ci.test_appimage_build_script
Ran 42 tests in 2.127s
OK
  • ci/test_assemble_appdir.py 12 pass (compat-lib errors -> 2, glibc-floor
    decision, EXCLUDE membership, Qt-plugin requirement -> 1, fail-closed
    not found, the full successful assembly, plus the three wiring tests).
  • ci/test_set_runpaths.py 6 pass - now asserts assemble_appdir.py builds the
    set_runpaths.py argv through uv run --no-project, with the loader
    directory appended only when glibc is bundled.
  • ci/test_appimage_host_stack.py 7 pass - the host-driver and glibc EXCLUDE
    rules now come from the module.
  • ci/test_glibc_floor.py 6 pass, ci/test_appimage_build_script.py 11 pass.

ruff check (the lane's C901, RUF100 over 344 files) and pyright on the new
module and its test are clean. ./lint's python lane passes; its two remaining
failures (test_gate_dylint.py, test_local_gate_probe.py) are environmental
on this host - a stray empty CARGO_TARGET_DIR and an older soldr broker - and
pass with CARGO_TARGET_DIR unset, unrelated to this diff.

What maps to what

shell Python
set -euo pipefail, trap main() returning a status; Failure(status); sys.exit
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) HERE = Path(__file__).resolve().parent
[[ $# -eq 2 ]] || { usage; exit 2; } arity check -> Failure(2)
readelf -d ... | grep -q '\[libavutil.so.60\]' capture(["readelf", "-d", ...]) + membership
readelf --dyn-syms --wide | grep UND ... vaMapBuffer2 _UNDEFINED_VAMAP regex over readelf --dyn-syms --wide
-x usr/bin/obs-studio-rust-gui, ln -s aliases is_file() / is_symlink(), symlink_to
gcc -print-multiarch capture(["gcc", "-print-multiarch"]) -> SYSLIB
getconf GNU_LIBC_VERSION, sort -V, floor 2.28 tuple compare against (2, 28) (#926)
EXCLUDE='...' / extended when BUNDLE_GLIBC=0 HOST_EXCLUDE / GLIBC_EXCLUDE regexes
qtpaths6 --query QT_INSTALL_PLUGINS, fallbacks find_program + --query, three required plugins, libqgtk3 removed
printf '[Paths]...' > usr/bin/qt.conf (appdir/"usr/bin/qt.conf").write_text(...)
find ... -perm -u+x, head -c4 177ELF OWNER_EXECUTE = 0o100, ELF_MAGIC = b"\x7fELF"
dpkg-query -S / dpkg-query -L capture(["dpkg-query", ...]) -> package -> files
sha256sum of the loader hashlib.sha256 over the glibc tree
patchelf --set-interpreter capture(["patchelf", "--set-interpreter", ...])
uv run --no-project "$HERE/set_runpaths.py" ... set_runpaths_command() -> same argv
check-appdir.sh, check-glibc-floor.py capture([...]) / uv run --script, fail on status

Also in this PR

  • build.py's appdir step runs uv run --no-project build-aux/appimage/assemble_appdir.py AppDir "${AVUTIL_LIB}".
  • The GEN-005 exception for build-aux/appimage/assemble-appdir.sh is removed
    from ci.toml.
  • README.md and the comments in check-appdir.sh, test-appimage.sh and
    set_runpaths.py name the new file.

@zackees
zackees marked this pull request as ready for review October 27, 2026 10:42
@zackees
zackees added this pull request to the merge queue Oct 27, 2026
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Evidence for handoff:

  • Local: ci/test_assemble_appdir.py 12 OK; ci.test_set_runpaths 6 OK; ci.test_appimage_host_stack 7 OK; ci.test_glibc_floor 6 OK; ci.test_appimage_build_script 11 OK; ci.test_ci_toml 19 OK; ruff check (C901, RUF100) clean on every changed Python file.
  • PR CI: Fast Gate ✅, Format 🔍 / checks ✅, CI Gate ✅.

Handed off to the coordinator (auto-merge on, queued).

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 27, 2026
@zackees
zackees force-pushed the infra/962-gen-005-assemble-appdir branch from 8294c75 to 4998318 Compare October 27, 2026 11:01
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Rebased onto master as the coordinator and adapted the rebase to two ports that landed while this PR was open.

Conflicts resolved (all mechanical):

  • ci.toml — the GEN-005 exception stanzas for assemble-appdir.sh and for check-appdir.sh are both gone now, since neither file exists on the branch any more. The stanzas removed are exactly this PR's own and master's.
  • build-aux/appimage/assemble-appdir.sh deleted, as the port intends.

Adapted to check-appdir.sh → check_appdir.py (#2596, merged):

  • assemble_appdir.py's final_checks() ran the shell script check-appdir.sh, which master no longer has. It now runs check_appdir.py with sys.executable — the same entry point master's test-appimage.sh:402 and the old assemble-appdir.sh:291 call. sys.executable rather than uv run keeps the helper out of the uv call list the test pins, matching how the shell executed it directly.
  • ci/test_assemble_appdir.py stubbed check-appdir.sh next to the module under test; it now stubs check_appdir.py. Same exit-0 stub.

Verified after the rebase (worktree at master c2a9d135e):

  • uv run python -m unittest ci.test_assemble_appdir ci.test_appimage_build_script ci.test_appimage_host_stack ci.test_ported_sources ci.test_ci_toml ci.test_uv_run → 57 tests OK.
  • ruff check on both touched files: clean.
  • git diff origin/master --stat: only this PR's own files.

Nothing else changed; the port's own logic is the author's.

@zackees
zackees enabled auto-merge October 27, 2026 11:02
…script (#962)

RED: build-aux/appimage/assemble_appdir.py does not exist yet, so
ci/test_assemble_appdir.py cannot load it and the wiring cases fail too
(12 tests, 9 errors, 3 failures -- the shell script is still there, build.py
still runs it and ci.toml still excepts it).

ci/test_assemble_appdir.py drives the port's decisions over a fake AppDir
with stub executables first on PATH, pinning: the compatibility-library audit
(a missing input, the wrong libavutil SONAME and a leftover vaMapBuffer2 all
stop the build with status 2), the glibc-floor decision (getconf at or below
2.28 leaves glibc to the host, above it bundles it), the host-driver EXCLUDE
set, the Qt plugin requirement (status 1), an unresolved dependency (fail
closed) and a whole successful assembly.
Replaces build-aux/appimage/assemble-appdir.sh (306 lines of bash) with
build-aux/appimage/assemble_appdir.py, preserving every branch, message
and exit code: usage and compatibility-library audit failures exit 2,
the Qt-plugin, gconv/PipeWire and loader failures exit 1, and the
`::error::` diagnostics go to stderr exactly as before.

The decisions are unchanged:
- the compat libavutil must have SONAME `[libavutil.so.60]` and no
  undefined `vaMapBuffer2`;
- GUI names/APP_ID/DATA_ROOT/MODULE_ROOT follow usr/bin/obs-studio-rust-gui;
- SYSLIB comes from `gcc -print-multiarch`;
- BUNDLE_GLIBC is the `getconf GNU_LIBC_VERSION` vs floor 2.28 comparison
  (issue #926), and the EXCLUDE regex gains the extra alternation when it
  is 0;
- Qt plugins come from `qtpaths6 --query QT_INSTALL_PLUGINS`, with the
  fallback, the three required plugins and the libqgtk3 removal;
- the ldd closure still fails closed on an unresolved dependency.

The subprocess helpers that the shell ran stay invoked the same way
(Python only through `uv run`): `hostlib/build.py` through
`uv run --no-project`, `set_runpaths.py` through
`uv run --no-project`, and `check-glibc-floor.py` through
`uv run --script`.

Also:
- build.py's appdir step runs the new module through uv;
- the GEN-005 exception for assemble-appdir.sh is gone from ci.toml;
- ci/test_appimage_host_stack.py, ci/test_set_runpaths.py and
  ci/test_glibc_floor.py now read the ported module instead of the shell
  file, with the same assertions;
- ci/test_appimage_build_script.py records the appdir step's new text;
- ci/test_assemble_appdir.py drives the decisions over a fake AppDir.

RED (eb80156): ci/test_assemble_appdir.py, 12 tests, 9 errors and 3
failures with the module absent. GREEN: the same 12 tests pass, and the
four touched ci files pass.
@zackees
zackees force-pushed the infra/962-gen-005-assemble-appdir branch from 4998318 to aba0cfb Compare October 27, 2026 11:05
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Worker rebase this tick supersedes the coordinator's mechanical rebase on master c2a9d135e.

The coordinator's rebase (4998318a5) left ci/test_check_appdir.py red: its WiringTest.test_assemble_appdir_runs_the_python_module_through_uv still reads build-aux/appimage/assemble-appdir.sh, which this PR deletes, so it raised FileNotFoundError. It also ran check_appdir.py from assemble_appdir.py with sys.executable, whereas the ported assemble-appdir.sh used uv run --no-project "$HERE/check_appdir.py" and check_appdir.py's own docstring still says so.

New head aba0cfb65 (replaces 4998318a5), rebased onto current master:

  • keeps master's check_appdir.py port (check-appdir.sh stays deleted) — the port no longer reverts it;
  • assemble_appdir.py runs check_appdir.py through uv run --no-project, matching the shell it replaces;
  • ci/test_check_appdir.py wiring test reads assemble_appdir.py and asserts that invocation;
  • ci/test_assemble_appdir.py stub renamed to check_appdir.py and the uv-call expectation updated to four steps;
  • ci.toml: the GEN-005 exception stanzas for both assemble-appdir.sh and check-appdir.sh are gone.

Local evidence: 64 AppImage ci/test_* cases OK, ci/test_ci_toml 19 OK, ci/test_uv_run 5 OK, ruff check --select C901,RUF100 clean.

@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit 8641851 Oct 27, 2026
31 checks passed
@zackees
zackees deleted the infra/962-gen-005-assemble-appdir branch October 27, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant