mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
fix(fex): install DroidDeck's FEX build again when it no longer loads
A tag that matches no longer vouches for the build: FEX and FEXServer must also load (ld.so --list), otherwise the session reinstalls it and x86 programs use the Steam or system FEX meanwhile.
This commit is contained in:
1 parent
8df90c30dd
commit
455bf0fba9
2 files changed
+32
-3
No files matched your search
@@ -155,11 +155,26 @@ def first_dir(prefix, candidates):
|
||||
return None
|
||||
|
||||
|
||||
def own_fex_loads():
|
||||
for name in ("FEX", "FEXServer"):
|
||||
binary = os.path.join(OWN_FEX, "bin", name)
|
||||
if not os.access(binary, os.X_OK):
|
||||
return False
|
||||
try:
|
||||
listed = subprocess.run(["/usr/lib/ld-linux-aarch64.so.1", "--list", binary],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=20)
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
return False
|
||||
if listed.returncode != 0 or b"not found" in listed.stdout:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def update_own_fex():
|
||||
wanted = os.environ.get("BL_FEX_TAG")
|
||||
if not wanted:
|
||||
return
|
||||
if (read_text(OWN_FEX_TAG) or "").strip() == wanted and os.access(os.path.join(OWN_FEX, "bin", "FEX"), os.X_OK):
|
||||
if (read_text(OWN_FEX_TAG) or "").strip() == wanted and own_fex_loads():
|
||||
return
|
||||
failed = os.path.join(STATE, "update-failed")
|
||||
try:
|
||||
@@ -184,7 +199,7 @@ def update_own_fex():
|
||||
|
||||
def fex_install():
|
||||
prefixes = []
|
||||
if os.path.isfile(OWN_FEX_TAG):
|
||||
if os.path.isfile(OWN_FEX_TAG) and own_fex_loads():
|
||||
prefixes.append((OWN_FEX, False))
|
||||
tool = app_dir(FEX_APPID)
|
||||
if tool:
|
||||
|
||||
@@ -204,13 +204,27 @@ class LocateTest(FexTestCase):
|
||||
self.assertEqual((fex["bin"], fex["server"], fex["portable"]), (str(tool / "usr/bin/FEX"), str(tool / "usr/bin/FEXServer"), True))
|
||||
self.assertTrue(fex["host_thunks"].endswith("HostThunks") and fex["guest_thunks"].endswith("GuestThunks") and fex["thunks_db"])
|
||||
|
||||
def own_fex(self, tag):
|
||||
def own_fex(self, tag, loads=True):
|
||||
own = self.tmp / "own"
|
||||
self.write(own / "bin/FEX", mode=0o755)
|
||||
self.write(own / "bin/FEXServer", mode=0o755)
|
||||
self.write(own / "share/fex-emu/.droiddeck-tag", tag + "\n")
|
||||
listing = b"libc.so.6 => /usr/lib/libc.so.6\n" if loads else b"libxxhash.so.0 => not found\n"
|
||||
patcher = mock.patch.object(G["subprocess"], "run", lambda args, **kw: subprocess.CompletedProcess(args, 0, listing))
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
return own
|
||||
|
||||
def test_an_own_build_that_no_longer_loads_is_installed_again_and_skipped(self):
|
||||
tool = self.fex_tool(self.steam)
|
||||
self.own_fex("fex-2610-r7", loads=False)
|
||||
calls = []
|
||||
with mock.patch.dict(os.environ, {"BL_FEX_TAG": "fex-2610-r7"}), \
|
||||
mock.patch.object(G["subprocess"], "call", lambda args, **kw: calls.append(args) or 1):
|
||||
FEX["update_own_fex"]()
|
||||
self.assertEqual([[str(BIN / "droiddeck-fex-update")]], calls)
|
||||
self.assertEqual(FEX["fex_install"]()["bin"], str(tool / "usr/bin/FEX"))
|
||||
|
||||
def test_droiddeck_s_own_build_comes_before_the_steam_tool(self):
|
||||
self.fex_tool(self.steam)
|
||||
own = self.own_fex("fex-2610-r7")
|
||||
|
||||
Reference in new issue
Block a user