mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix(fex): require ffi for provider Wayland libraries
This commit is contained in:
1 parent
5fde085d64
commit
9f980d4363
2 files changed
+35
-6
No files matched your search
@@ -37,7 +37,7 @@ RUNTIMES = {SNIPER_APPID: ("sniper_platform_", "Steam Linux Runtime 3.0 (sniper"
|
||||
SLR4_APPID: ("steamrt4_platform_", "Steam Linux Runtime 4.0 (steamrt4")}
|
||||
MARKER = ".droiddeck-fex"
|
||||
LAYOUT = 1
|
||||
ROOTFS_LAYOUT = 5
|
||||
ROOTFS_LAYOUT = 6
|
||||
ARCH_DIRS = ("x86_64-linux-gnu", "i386-linux-gnu")
|
||||
INTERPRETERS = ("ld-linux-x86-64.so.2", "ld-linux.so.2")
|
||||
PROVIDED = frozenset((
|
||||
@@ -313,10 +313,15 @@ def provides_newer(base, provider):
|
||||
|
||||
|
||||
def mirror(source, provider, name, target):
|
||||
if provider and name in PROVIDED and os.path.exists(os.path.join(provider, name)):
|
||||
wayland_needs_ffi = name in ("libwayland-client.so.0", "libwayland-server.so.0")
|
||||
usable_provider = provider and os.path.exists(os.path.join(provider, name)) and (
|
||||
not wayland_needs_ffi or os.path.exists(os.path.join(provider, "libffi.so.8")))
|
||||
if name in PROVIDED and usable_provider:
|
||||
os.symlink(os.path.realpath(os.path.join(provider, name)), os.path.join(target, name))
|
||||
return
|
||||
path = os.path.join(source, name)
|
||||
if not os.path.lexists(path):
|
||||
return
|
||||
link = os.readlink(path) if os.path.islink(path) else None
|
||||
if link and GLIBC_BUILD.match(os.path.basename(link)):
|
||||
if name not in INTERPRETERS:
|
||||
|
||||
@@ -486,6 +486,7 @@ class PrepareTest(FexTestCase):
|
||||
base = sniper / "files/lib/x86_64-linux-gnu"
|
||||
newer = provider / "files/lib/x86_64-linux-gnu"
|
||||
source = self.tmp / "library.c"
|
||||
self.write(newer / "libffi.so.8", b"ffi")
|
||||
for folder, symbol in ((base, "wl_proxy_marshal"), (newer, "wl_proxy_marshal_flags")):
|
||||
source.write_text("void *%s(void) { return 0; }\n" % symbol)
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-nostdlib", "-Wl,-soname,libwayland-client.so.0",
|
||||
@@ -596,16 +597,39 @@ class PrepareTest(FexTestCase):
|
||||
root = Path(fex["rootfs"]) / "lib" / arch
|
||||
self.assertEqual((root / "libwayland-client.so.0").read_bytes(), b"base")
|
||||
self.assertFalse(os.path.lexists(root / "libffi.so.8"))
|
||||
self.assertEqual((root / "libwayland-server.so.0").read_bytes(), b"provider")
|
||||
self.assertEqual((root / "libwayland-server.so.0").resolve(),
|
||||
provider / "files/lib" / arch / "wayland-server-real.so")
|
||||
self.assertFalse(os.path.lexists(root / "libwayland-server.so.0"))
|
||||
|
||||
def test_wayland_requires_usable_provider_ffi_on_both_architectures(self):
|
||||
self.fex_tool()
|
||||
sniper = self.runtime()
|
||||
FEX["materialize"](str(sniper))
|
||||
provider = self.graphics(sniper)
|
||||
for ffi_state in ("missing", "dangling"):
|
||||
with self.subTest(ffi_state=ffi_state):
|
||||
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||
base = sniper / "files/lib" / arch
|
||||
newer = provider / "files/lib" / arch
|
||||
for name in ("libwayland-client.so.0", "libwayland-server.so.0"):
|
||||
self.write(base / name, b"base")
|
||||
self.write(newer / name, b"provider")
|
||||
if ffi_state == "dangling":
|
||||
os.symlink("missing-ffi.so", newer / "libffi.so.8")
|
||||
marker = self.home / ".local/share/droiddeck-fex/rootfs/.droiddeck-fex"
|
||||
if marker.exists():
|
||||
marker.unlink()
|
||||
fex, _ = self.quiet(FEX["prepare"])
|
||||
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||
root = Path(fex["rootfs"]) / "lib" / arch
|
||||
for name in ("libwayland-client.so.0", "libwayland-server.so.0"):
|
||||
self.assertEqual((root / name).read_bytes(), b"base")
|
||||
self.assertFalse(os.path.lexists(root / "libffi.so.8"))
|
||||
|
||||
def test_the_old_rootfs_layout_is_rebuilt(self):
|
||||
self.fex_tool()
|
||||
sniper = self.runtime()
|
||||
FEX["materialize"](str(sniper))
|
||||
self.graphics(sniper)
|
||||
with mock.patch.dict(G, {"ROOTFS_LAYOUT": 4}):
|
||||
with mock.patch.dict(G, {"ROOTFS_LAYOUT": 5}):
|
||||
self.quiet(FEX["prepare"])
|
||||
_, said = self.quiet(FEX["prepare"])
|
||||
self.assertIn("built the x86 runtime", said)
|
||||
|
||||
Reference in new issue
Block a user