mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
fix(fex): fall back when provider links are broken
This commit is contained in:
1 parent
893aa5a517
commit
5fde085d64
2 files changed
+26
-4
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")}
|
SLR4_APPID: ("steamrt4_platform_", "Steam Linux Runtime 4.0 (steamrt4")}
|
||||||
MARKER = ".droiddeck-fex"
|
MARKER = ".droiddeck-fex"
|
||||||
LAYOUT = 1
|
LAYOUT = 1
|
||||||
ROOTFS_LAYOUT = 4
|
ROOTFS_LAYOUT = 5
|
||||||
ARCH_DIRS = ("x86_64-linux-gnu", "i386-linux-gnu")
|
ARCH_DIRS = ("x86_64-linux-gnu", "i386-linux-gnu")
|
||||||
INTERPRETERS = ("ld-linux-x86-64.so.2", "ld-linux.so.2")
|
INTERPRETERS = ("ld-linux-x86-64.so.2", "ld-linux.so.2")
|
||||||
PROVIDED = frozenset((
|
PROVIDED = frozenset((
|
||||||
@@ -313,7 +313,7 @@ def provides_newer(base, provider):
|
|||||||
|
|
||||||
|
|
||||||
def mirror(source, provider, name, target):
|
def mirror(source, provider, name, target):
|
||||||
if provider and name in PROVIDED and os.path.lexists(os.path.join(provider, name)):
|
if provider and name in PROVIDED and os.path.exists(os.path.join(provider, name)):
|
||||||
os.symlink(os.path.realpath(os.path.join(provider, name)), os.path.join(target, name))
|
os.symlink(os.path.realpath(os.path.join(provider, name)), os.path.join(target, name))
|
||||||
return
|
return
|
||||||
path = os.path.join(source, name)
|
path = os.path.join(source, name)
|
||||||
@@ -354,7 +354,7 @@ def build_rootfs(base, provider):
|
|||||||
if entry in ARCH_DIRS and os.path.isdir(path) and not os.path.islink(path):
|
if entry in ARCH_DIRS and os.path.isdir(path) and not os.path.islink(path):
|
||||||
provided = os.path.join(provider_files, top, entry)
|
provided = os.path.join(provider_files, top, entry)
|
||||||
os.makedirs(os.path.join(tmp, top, entry))
|
os.makedirs(os.path.join(tmp, top, entry))
|
||||||
for name in set(os.listdir(path)) | {name for name in PROVIDED if os.path.lexists(os.path.join(provided, name))}:
|
for name in set(os.listdir(path)) | {name for name in PROVIDED if os.path.exists(os.path.join(provided, name))}:
|
||||||
mirror(path, provided, name, os.path.join(tmp, top, entry))
|
mirror(path, provided, name, os.path.join(tmp, top, entry))
|
||||||
else:
|
else:
|
||||||
mirror(source, None, entry, os.path.join(tmp, top))
|
mirror(source, None, entry, os.path.join(tmp, top))
|
||||||
|
|||||||
@@ -578,12 +578,34 @@ class PrepareTest(FexTestCase):
|
|||||||
fex, _ = self.quiet(FEX["prepare"])
|
fex, _ = self.quiet(FEX["prepare"])
|
||||||
self.assertEqual((Path(fex["rootfs"]) / "lib/x86_64-linux-gnu/libwayland-client.so.0").resolve(), base)
|
self.assertEqual((Path(fex["rootfs"]) / "lib/x86_64-linux-gnu/libwayland-client.so.0").resolve(), base)
|
||||||
|
|
||||||
|
def test_provider_symlinks_require_existing_targets_on_both_architectures(self):
|
||||||
|
self.fex_tool()
|
||||||
|
sniper = self.runtime()
|
||||||
|
FEX["materialize"](str(sniper))
|
||||||
|
provider = self.graphics(sniper)
|
||||||
|
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||||
|
base = sniper / "files/lib" / arch
|
||||||
|
newer = provider / "files/lib" / arch
|
||||||
|
self.write(base / "libwayland-client.so.0", b"base")
|
||||||
|
os.symlink("missing-client.so", newer / "libwayland-client.so.0")
|
||||||
|
os.symlink("missing-ffi.so", newer / "libffi.so.8")
|
||||||
|
self.write(newer / "wayland-server-real.so", b"provider")
|
||||||
|
os.symlink("wayland-server-real.so", newer / "libwayland-server.so.0")
|
||||||
|
fex, _ = self.quiet(FEX["prepare"])
|
||||||
|
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||||
|
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")
|
||||||
|
|
||||||
def test_the_old_rootfs_layout_is_rebuilt(self):
|
def test_the_old_rootfs_layout_is_rebuilt(self):
|
||||||
self.fex_tool()
|
self.fex_tool()
|
||||||
sniper = self.runtime()
|
sniper = self.runtime()
|
||||||
FEX["materialize"](str(sniper))
|
FEX["materialize"](str(sniper))
|
||||||
self.graphics(sniper)
|
self.graphics(sniper)
|
||||||
with mock.patch.dict(G, {"ROOTFS_LAYOUT": 3}):
|
with mock.patch.dict(G, {"ROOTFS_LAYOUT": 4}):
|
||||||
self.quiet(FEX["prepare"])
|
self.quiet(FEX["prepare"])
|
||||||
_, said = self.quiet(FEX["prepare"])
|
_, said = self.quiet(FEX["prepare"])
|
||||||
self.assertIn("built the x86 runtime", said)
|
self.assertIn("built the x86 runtime", said)
|
||||||
|
|||||||
Reference in new issue
Block a user