mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-01 13:58:55 -06:00
fix: write the published checksums in split_pack
This commit is contained in:
1 parent
83f7693ccb
commit
ef7884500e
10 files changed
+88
-35
No files matched your search
@@ -7,9 +7,9 @@ import subprocess
|
||||
from dataclasses import dataclass
|
||||
|
||||
from model.largefiles import LARGE_FILES_REPO, digests_of
|
||||
from release.sums import SUMS
|
||||
|
||||
|
||||
SUMS = "SHA256SUMS.txt"
|
||||
SIGNATURE = SUMS + ".sig"
|
||||
@dataclass(frozen=True)
|
||||
class Asset:
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
"""The checksum list of the pack files a release publishes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from core.hashing import file_digest
|
||||
from model.releaserecord import PACK_SUFFIX
|
||||
|
||||
SUMS = "SHA256SUMS.txt"
|
||||
|
||||
|
||||
def published_packs(directory: Path) -> list[Path]:
|
||||
"""The pack files a release uploads from a directory: whole packs and parts."""
|
||||
stem = PACK_SUFFIX.removesuffix(".zip")
|
||||
return sorted(
|
||||
path for path in Path(directory).glob(f"*{stem}*.zip") if path.is_file()
|
||||
)
|
||||
|
||||
|
||||
def write_sums(directory: Path) -> Path | None:
|
||||
"""Write SHA256SUMS.txt over the published packs, in `sha256sum` form.
|
||||
|
||||
Returns its path, or None when the directory holds no pack.
|
||||
"""
|
||||
lines = [
|
||||
f"{file_digest(path, 'sha256')} {path.name}" for path in published_packs(directory)
|
||||
]
|
||||
if not lines:
|
||||
return None
|
||||
sums = Path(directory) / SUMS
|
||||
sums.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
||||
return sums
|
||||
Reference in new issue
Block a user