fix: publish the manifests the pages link

This commit is contained in:
Abdessamad Derraz committed 2026-11-23 21:44:08 +01:00
1 parent 19871672e1
commit 2971219571
2 files changed
+22 -5

No files matched your search

+7 -4
View File
@@ -6,7 +6,7 @@ import json
import shutil
from pathlib import Path
from model import releaserecord
from model import releaserecord, siteinputs
from core.paths import REPO_ROOT
from sitegen.write import record_written, write_if_changed
@@ -33,12 +33,15 @@ def publish_manifests(api: Path) -> list[tuple]:
pack installs: Batocera's list holds 353 files, its pack 14,508. The
only copy was install/<platform>.json on the repository's main branch,
which no page named. Copied byte for byte: the SHA256 the catalog gives
is the repository file's.
is the repository file's. Read from the folder the pages link from
(siteinputs.manifests_dir), so a run on another collection serves the
manifests its pages and DATs describe.
"""
manifests = siteinputs.manifests_dir()
folder = api / "manifests"
folder.mkdir(parents=True, exist_ok=True)
assets: list[tuple] = []
for source in sorted((REPO_ROOT / "install").glob("*.json")):
for source in sorted(manifests.glob("*.json")):
target = folder / source.name
shutil.copy2(source, target)
record_written(target)
@@ -48,7 +51,7 @@ def publish_manifests(api: Path) -> list[tuple]:
# api/v1/targets/ answered 404.
targets = api / "targets"
targets.mkdir(parents=True, exist_ok=True)
for source in sorted((REPO_ROOT / "install" / "targets").glob("*.json")):
for source in sorted((manifests / "targets").glob("*.json")):
shutil.copy2(source, targets / source.name)
record_written(targets / source.name)
assets.append((targets / source.name, f"Target list: {source.stem}",
+15 -1
View File
@@ -70,6 +70,20 @@ class TheGivenDatabase(_Inputs):
(self.db.parent / "install" / "retroarch.json").write_text("{}")
self.assertIn("install manifest", platformfiles.platform_data_links("retroarch"))
def test_the_published_manifests_are_the_ones_the_pages_link(self) -> None:
from sitegen.publish import publish_manifests
given = self.db.parent / "install"
(given / "targets").mkdir(parents=True)
(given / "onlyhere.json").write_text('{"given": 1}')
(given / "targets" / "onlyhere.json").write_text('{"given": 2}')
api = self.db.parent / "api"
self.use(db=self.db)
publish_manifests(api)
self.assertEqual(sorted(p.name for p in (api / "manifests").iterdir()), ["onlyhere.json"])
self.assertEqual((api / "manifests" / "onlyhere.json").read_text(), '{"given": 1}')
self.assertEqual(sorted(p.name for p in (api / "targets").iterdir()), ["onlyhere.json"])
def test_board_election_opens_the_given_collection_archive(self) -> None:
import zipfile
@@ -227,7 +241,7 @@ class NoPageModuleReadsTheRepositoryInputs(unittest.TestCase):
def test_no_page_module_reads_the_repository_manifests(self) -> None:
modules = [SCRIPTS / "sitegen" / f"{name}.py"
for name in ("render", "platformfiles", "whichpack", "structured", "install",
"lookup", "build", "guidepage", "diagrams")]
"lookup", "build", "guidepage", "diagrams", "publish")]
found = [
f"{module.name}:{node.lineno}"
for module in modules