mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-02 06:18:51 -06:00
fix: purge the old checksum signature with packs
The stale-pack purge kept its own list of release files and left SHA256SUMS.txt.sig behind, which a skipped signing step then published beside a new checksum list. release.sums now owns the release set.
This commit is contained in:
1 parent
e51dc14d7b
commit
8348ba1f32
7 files changed
+42
-15
No files matched your search
@@ -33,12 +33,11 @@ from model.registry import list_release_pack_platforms
|
||||
from core.cli import require_directory
|
||||
from model.releaserecord import RECORD, load_record
|
||||
from release.check import (
|
||||
SIGNATURE,
|
||||
SUMS,
|
||||
compare_release,
|
||||
fetch_assets,
|
||||
fetch_sums,
|
||||
)
|
||||
from release.sums import SIGNATURE, SUMS
|
||||
from core.hashing import parse_sha256sums
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ from orchestrate import runner
|
||||
from orchestrate.labels import STEP_LABELS, skip_notice
|
||||
from orchestrate.results import SKIPPED
|
||||
from packs.datadirs import hold_data_dirs
|
||||
from release.sums import release_set_files
|
||||
|
||||
|
||||
def scratch_file(prefix: str) -> str:
|
||||
@@ -98,14 +99,7 @@ def purge_stale_packs(output_dir: str) -> None:
|
||||
return
|
||||
try:
|
||||
with artifact_lock(str(out_dir)):
|
||||
stale = [
|
||||
p for p in out_dir.iterdir()
|
||||
if p.is_file() and (
|
||||
p.suffix == ".zip"
|
||||
or ".zip." in p.name
|
||||
or p.name == "SHA256SUMS.txt"
|
||||
)
|
||||
]
|
||||
stale = release_set_files(out_dir)
|
||||
for p in stale:
|
||||
p.unlink()
|
||||
if stale:
|
||||
|
||||
@@ -7,10 +7,9 @@ import subprocess
|
||||
from dataclasses import dataclass
|
||||
|
||||
from model.largefiles import LARGE_FILES_REPO, digests_of
|
||||
from release.sums import SUMS
|
||||
from release.sums import SIGNATURE, SUMS
|
||||
|
||||
|
||||
SIGNATURE = SUMS + ".sig"
|
||||
@dataclass(frozen=True)
|
||||
class Asset:
|
||||
size: int
|
||||
|
||||
@@ -8,6 +8,7 @@ from core.hashing import file_digest
|
||||
from model.releaserecord import PACK_SUFFIX
|
||||
|
||||
SUMS = "SHA256SUMS.txt"
|
||||
SIGNATURE = SUMS + ".sig"
|
||||
|
||||
|
||||
def published_packs(directory: Path) -> list[Path]:
|
||||
@@ -18,6 +19,20 @@ def published_packs(directory: Path) -> list[Path]:
|
||||
)
|
||||
|
||||
|
||||
def release_set_files(directory: Path) -> list[Path]:
|
||||
"""The files a pack build and its release leave in a directory.
|
||||
|
||||
Every ZIP and the legacy `.zip.NNN` slices, the checksum list and its
|
||||
signature: a new build replaces them all, or an old one is published.
|
||||
"""
|
||||
return sorted(
|
||||
path for path in Path(directory).iterdir()
|
||||
if path.is_file() and (
|
||||
path.suffix == ".zip" or ".zip." in path.name or path.name in (SUMS, SIGNATURE)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def write_sums(directory: Path) -> Path | None:
|
||||
"""Write SHA256SUMS.txt over the published packs, in `sha256sum` form.
|
||||
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ COMMANDS = {
|
||||
),
|
||||
"release_record.py": ("model/releaserecord.py", "release/record.py"),
|
||||
"release_notes.py": ("release/notes.py",),
|
||||
"check_release.py": ("release/check.py",),
|
||||
"check_release.py": ("release/check.py", "release/sums.py"),
|
||||
"check_release_assets.py": ("release/assets.py",),
|
||||
"sync_release_assets.py": ("release/sync.py",),
|
||||
"restore_large_files.py": ("release/restore.py",),
|
||||
|
||||
@@ -58,8 +58,9 @@ SIBLING_IMPORTS: dict[str, frozenset[str]] = {
|
||||
# site's source trees and profile_sync's report.
|
||||
"freshness": frozenset({"scraper", "exporter", "packs", "installer_build", "sitegen", "profiling"}),
|
||||
# Step 5 builds the packs in memory, and the offline export refusal asks
|
||||
# the exporters which ones patch a cached original.
|
||||
"orchestrate": frozenset({"packs", "exporter"}),
|
||||
# the exporters which ones patch a cached original. The stale-pack purge
|
||||
# deletes the release set the release code defines.
|
||||
"orchestrate": frozenset({"packs", "exporter", "release"}),
|
||||
"games": frozenset(),
|
||||
}
|
||||
|
||||
|
||||
@@ -338,5 +338,24 @@ class PartsAreExplainedWhereTheyAreDownloaded(unittest.TestCase):
|
||||
self.assertTrue("cmd /c copy /b" in line, line.strip())
|
||||
|
||||
|
||||
class PurgeTakesTheWholeReleaseSet(unittest.TestCase):
|
||||
"""The purge kept the last release's SHA256SUMS.txt.sig beside new packs
|
||||
and a new checksum list: published unsigned, every verify failed."""
|
||||
|
||||
def test_the_signature_goes_with_the_packs(self) -> None:
|
||||
from orchestrate.build import purge_stale_packs
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
dist = Path(tmp)
|
||||
names = ("A_BIOS_Pack.zip", "A_BIOS_Pack.zip.001", "SHA256SUMS.txt",
|
||||
"SHA256SUMS.txt.sig", "release.json")
|
||||
for name in names:
|
||||
(dist / name).write_bytes(b"x")
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
purge_stale_packs(str(dist))
|
||||
left = sorted(p.name for p in dist.iterdir() if p.name != ".lock")
|
||||
self.assertEqual(left, ["release.json"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user