Repository navigation
fix(release): don't bundle libwayland into the Tauri AppImage, and gate it #1509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
539577a
585ca95
0fadc04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| """Tests for scripts/package/host-abi-gate.sh on fake bundle trees.""" | ||
|
|
||
| import os | ||
| import subprocess | ||
| from pathlib import Path | ||
| from typing import Optional | ||
|
|
||
| import pytest | ||
|
|
||
| GATE = Path(__file__).parents[1] / "package" / "host-abi-gate.sh" | ||
| WAYLAND_ONLY = "libwayland-client libwayland-cursor libwayland-egl libwayland-server" | ||
|
|
||
|
|
||
| def run_gate(bundle: Path, libs_list: Optional[str] = None) -> int: | ||
| env = {k: v for k, v in os.environ.items() if k != "HOST_ABI_LIBS_LIST"} | ||
| if libs_list is not None: | ||
| env["HOST_ABI_LIBS_LIST"] = libs_list | ||
| return subprocess.run( | ||
| ["bash", str(GATE), str(bundle)], env=env, capture_output=True | ||
| ).returncode | ||
|
|
||
|
|
||
| def make_bundle(tmp_path: Path, *libs: str) -> Path: | ||
| lib_dir = tmp_path / "bundle" / "usr" / "lib" | ||
| lib_dir.mkdir(parents=True) | ||
| (lib_dir / "libgtk-3.so.0").touch() # never flagged | ||
| for name in libs: | ||
| (lib_dir / name).touch() | ||
| return tmp_path / "bundle" | ||
|
|
||
|
|
||
| def test_clean_bundle_passes(tmp_path: Path): | ||
| assert run_gate(make_bundle(tmp_path)) == 0 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("lib", ["libglib-2.0.so.0", "libgio-2.0.so.0", "libwayland-client.so.0"]) | ||
| def test_default_list_rejects_host_abi_libs(tmp_path: Path, lib: str): | ||
| assert run_gate(make_bundle(tmp_path, lib)) == 1 | ||
|
|
||
|
|
||
| def test_override_rejects_wayland(tmp_path: Path): | ||
| bundle = make_bundle(tmp_path, "libglib-2.0.so.0", "libwayland-egl.so.1") | ||
| assert run_gate(bundle, WAYLAND_ONLY) == 1 | ||
|
|
||
|
|
||
| def test_override_replaces_rather_than_extends_default(tmp_path: Path): | ||
| # The Tauri AppImage keeps glib on purpose: with the wayland-only list, | ||
| # glib must pass, while the default list still rejects it. | ||
| bundle = make_bundle(tmp_path, "libglib-2.0.so.0", "libgobject-2.0.so.0") | ||
| assert run_gate(bundle, WAYLAND_ONLY) == 0 | ||
| assert run_gate(bundle) == 1 | ||
|
|
||
|
|
||
| def test_empty_override_keeps_default(tmp_path: Path): | ||
| assert run_gate(make_bundle(tmp_path, "libglib-2.0.so.0"), "") == 1 | ||
|
|
||
|
|
||
| def test_symlinked_name_is_flagged(tmp_path: Path): | ||
| # The forbidden name exists only as a link to a harmless file, so this | ||
| # fails if the gate stops checking symlinks. | ||
| bundle = make_bundle(tmp_path) | ||
| (bundle / "usr" / "lib" / "libwayland-client.so.0").symlink_to("libgtk-3.so.0") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. False positive. Verified on current head |
||
| assert run_gate(bundle, WAYLAND_ONLY) == 1 | ||
Uh oh!
There was an error while loading. Please reload this page.