mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-23 20:29:06 -05:00
fix: name the file existence mode finds
verify_entry_existence returned no path, so RetroArch, Lakka and RetroPie pages showed no Served by line. It now returns the resolved path as the hash modes do. verify.py --all prints the same bytes and its JSON is unchanged.
This commit is contained in:
1 parent
6cac923a91
commit
7c6af30a0c
3 files changed
+14
-3
No files matched your search
@@ -2380,7 +2380,7 @@ def _served_line(f: dict) -> str:
|
||||
if f.get("status") == "missing":
|
||||
return "Not held"
|
||||
if not path:
|
||||
# verify reports no path in existence mode: nothing to name.
|
||||
# A slot the pack fills from a release asset or leaves to the user.
|
||||
return ""
|
||||
sha1 = _collection_sha1_by_path().get(path, "")
|
||||
label = "Served by" if f.get("status") == "ok" else "Held, not the declared hash"
|
||||
|
||||
+3
-2
@@ -189,12 +189,13 @@ def verify_entry_existence(
|
||||
resolve_status: str = "",
|
||||
platform_display: str = "",
|
||||
) -> dict:
|
||||
"""RetroArch verification: path_is_valid(), a file that exists is OK."""
|
||||
"""RetroArch verification: path_is_valid(), a file that exists is OK.
|
||||
The result names the collection file found, as the hash modes do."""
|
||||
name = file_entry.get("name", "")
|
||||
required = file_entry.get("required", True)
|
||||
if not local_path:
|
||||
return {"name": name, "status": Status.MISSING, "required": required}
|
||||
result = {"name": name, "status": Status.OK, "required": required}
|
||||
result = {"name": name, "status": Status.OK, "required": required, "path": local_path}
|
||||
if resolve_status == "hash_mismatch":
|
||||
# The frontend reads no bytes, so the file stays, and the declared hash
|
||||
# it contradicts is reported, as the pack does.
|
||||
|
||||
@@ -152,6 +152,16 @@ class ExistenceReportsWhatThePackReports(unittest.TestCase):
|
||||
self.assertEqual(result["status"], verify.Status.OK)
|
||||
self.assertIn("declared hash 9d2ff233", result["discrepancy"])
|
||||
|
||||
def test_the_file_found_is_named(self):
|
||||
"""RetroArch, Lakka and RetroPie pages showed no "Served by" line:
|
||||
existence mode returned no path, where the hash modes return one."""
|
||||
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||
import verify # noqa: PLC0415
|
||||
|
||||
found = verify.verify_entry_existence({"name": "a.bin"}, "bios/X/Y/a.bin")
|
||||
self.assertEqual(found["path"], "bios/X/Y/a.bin")
|
||||
self.assertNotIn("path", verify.verify_entry_existence({"name": "a.bin"}, None))
|
||||
|
||||
|
||||
class TheDestinationsFlagNeedsAPack(unittest.TestCase):
|
||||
"""--destinations describes a platform's full pack: another mode refuses it."""
|
||||
|
||||
Reference in new issue
Block a user