mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 21:15:43 +00:00
fix(bionic): check DroidDeck-Bionic releases only with Run without proot on
ProtonExtras.offered() lists DroidDeck-Bionic only when no-proot is on; the release check and the Proton list use it, so devices without no-proot make no extra GitHub request (the update-check test caught the new source). test_proton_extra: the fourth source, its archive pattern next to DroidDeck-Proton's, its prerelease.
This commit is contained in:
1 parent
7e4ed9b7df
commit
a5f7405032
3 files changed
+20
-4
No files matched your search
@@ -87,8 +87,7 @@ internal class ProtonMenu(
|
||||
}
|
||||
|
||||
fun refreshProtons() {
|
||||
val bionic = com.droiddeck.launcher.runtime.NativeGuest.enabled(activity)
|
||||
protonRows = ProtonExtras.tools.filter { it.id != ProtonExtras.BIONIC || bionic }.map {
|
||||
protonRows = ProtonExtras.offered(activity).map {
|
||||
val all = ProtonExtras.installedAll(activity, it)
|
||||
ProtonRow(it.id, it.name, all.lastOrNull(), ProtonExtras.queued(activity, it), all, ProtonExtras.update(activity, it))
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.util.Log
|
||||
import com.droiddeck.launcher.core.Downloader
|
||||
import com.droiddeck.launcher.core.FileUtils
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.NativeGuest
|
||||
import java.io.File
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
@@ -40,6 +41,9 @@ object ProtonExtras {
|
||||
Tool(BIONIC, "DroidDeck-Bionic", "DroidDeck-Bionic", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Bionic-.*aarch64\\.tar\\.(gz|xz)$"), prereleases = true),
|
||||
)
|
||||
|
||||
/** The sources offered on this device: DroidDeck-Bionic only with Run without proot on. */
|
||||
fun offered(context: Context): List<Tool> = tools.filter { it.id != BIONIC || NativeGuest.enabled(context) }
|
||||
|
||||
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
|
||||
private fun requests(context: Context) = File(home(context), ".bl-proton-extra")
|
||||
private fun toolsDir(context: Context) = File(home(context), ".local/share/Steam/compatibilitytools.d")
|
||||
@@ -117,7 +121,7 @@ object ProtonExtras {
|
||||
synchronized(checkLock) {
|
||||
val file = latestFile(context)
|
||||
val cache = readJson(file)
|
||||
val due = tools.filter { tool ->
|
||||
val due = offered(context).filter { tool ->
|
||||
val at = cache.optJSONObject(tool.id)?.optLong("at", 0L) ?: 0L
|
||||
force || (now - at) !in 0 until CHECK_EVERY_MS
|
||||
}
|
||||
|
||||
@@ -27,13 +27,26 @@ def droiddeck_release(ver, prerelease=False, draft=False):
|
||||
|
||||
class ProtonExtraTest(unittest.TestCase):
|
||||
def test_sources_and_their_arm64_assets(self):
|
||||
self.assertEqual(list(EXTRA["SOURCES"]), ["ge", "cachyos", "droiddeck"])
|
||||
self.assertEqual(list(EXTRA["SOURCES"]), ["ge", "cachyos", "droiddeck", "bionic"])
|
||||
repo, pattern = EXTRA["SOURCES"]["droiddeck"]
|
||||
self.assertEqual(repo, "Droid-Deck/DroidDeck-Proton")
|
||||
self.assertTrue(pattern.search("DroidDeck-Proton-11-7.5-aarch64.tar.gz"))
|
||||
self.assertTrue(pattern.search("DroidDeck-Proton-11-8-aarch64.tar.xz"))
|
||||
self.assertFalse(pattern.search("DroidDeck-Proton-11-7.5-aarch64.sha512sum"))
|
||||
self.assertFalse(pattern.search("DroidDeck-Proton-11-7.5-aarch64.build-info.json"))
|
||||
self.assertFalse(pattern.search("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"))
|
||||
repo, pattern = EXTRA["SOURCES"]["bionic"]
|
||||
self.assertEqual(repo, "Droid-Deck/DroidDeck-Proton")
|
||||
self.assertTrue(pattern.search("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"))
|
||||
self.assertFalse(pattern.search("DroidDeck-Proton-11-7.5-aarch64.tar.gz"))
|
||||
|
||||
def test_bionic_takes_its_prerelease(self):
|
||||
stem = "DroidDeck-Bionic-12.8-r3-aarch64"
|
||||
releases = [{"tag_name": "DroidDeck-Bionic-12.8-r3", "prerelease": True, "draft": False,
|
||||
"assets": [asset(stem + ".sha512sum"), asset(stem + ".tar.xz")]}, droiddeck_release("11-7.5")]
|
||||
with mock.patch.dict(GLOBALS, {"fetch_json": lambda url: releases}):
|
||||
self.assertEqual(EXTRA["pick_asset"]("bionic")[0], "DroidDeck-Bionic-12.8-r3")
|
||||
self.assertEqual(EXTRA["pick_asset"]("droiddeck")[0], "DroidDeck-Proton-11-7.5")
|
||||
|
||||
def test_the_newest_full_release_with_its_sha512_file(self):
|
||||
releases = [droiddeck_release("11-8", prerelease=True), droiddeck_release("11-7.9", draft=True), droiddeck_release("11-7.5")]
|
||||
|
||||
Reference in new issue
Block a user