mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 01:57:48 -06:00
refactor: stamp site data with build_timestamp
This commit is contained in:
1 parent
88ee986ee6
commit
6df0ec503b
5 files changed
+12
-14
No files matched your search
@@ -11,6 +11,7 @@ from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from core.artifacts import build_timestamp
|
||||
from romrecipes import ledger
|
||||
from model import releaserecord
|
||||
from model import siteinputs
|
||||
@@ -38,7 +39,7 @@ from sitegen import (
|
||||
wanted as sitewanted,
|
||||
)
|
||||
from sitegen.cards import wanted_link, system_install_choices, tables_out_of_search
|
||||
from sitegen.config import GENERATED_DIRS, PUBLIC_DIRS, REPO_URL, data_timestamp, yaml
|
||||
from sitegen.config import GENERATED_DIRS, PUBLIC_DIRS, REPO_URL, yaml
|
||||
from core.paths import REPO_ROOT
|
||||
from sitegen.crossref import generate_cross_reference
|
||||
from sitegen.dataexports import (
|
||||
@@ -287,7 +288,7 @@ def _write_system_pages(run: _SiteRun) -> None:
|
||||
public / "api" / "v1" / "systems" / f"{slug}.json", "systems",
|
||||
# The published data keeps the collection's folders.
|
||||
system_export_item(slug, mfr, manufacturers[mfr]),
|
||||
str(db.get("generated_at") or data_timestamp()), source_commit(),
|
||||
build_timestamp(db), source_commit(),
|
||||
)
|
||||
clash = split_system_stems() & {manufacturer_slug(m) for m in manufacturers}
|
||||
if clash:
|
||||
@@ -422,7 +423,7 @@ def _write_emulator_page(run: _SiteRun, name: str, profile: dict) -> None:
|
||||
write_single_item(
|
||||
run.public / "api" / "v1" / "emulators" / f"{name}.json", "emulators",
|
||||
{"id": name, "profile": profile},
|
||||
str(db.get("generated_at") or data_timestamp()), source_commit(),
|
||||
build_timestamp(db), source_commit(),
|
||||
)
|
||||
pages = emulator_pages(
|
||||
name, profile, db, run.consumers, run.suppl_names, run.data_registry,
|
||||
|
||||
@@ -48,11 +48,6 @@ def build_commit(root: Path = REPO_ROOT) -> str:
|
||||
return commit
|
||||
|
||||
|
||||
def data_timestamp() -> str:
|
||||
"""The build time for data files (stats, API records), ISO 8601."""
|
||||
return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
|
||||
def data_as_of(moment: datetime | None = None) -> str:
|
||||
"""The build date for a reader, in words, with the machine form beside it.
|
||||
A raw ISO stamp ("2026-10-22T22:43:08Z") closed the home page."""
|
||||
|
||||
@@ -13,6 +13,7 @@ import sys
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
from core.artifacts import build_timestamp
|
||||
from core.artifacts import json_text as _json_text
|
||||
from core.hashing import file_digest
|
||||
from model import retired as model_retired
|
||||
@@ -22,7 +23,7 @@ from model.profiles import is_emulator
|
||||
from packs.crossref import FileConsumers
|
||||
from acquire.provenance import build_report
|
||||
from sitegen.apiitems import core_index_items, system_index_items
|
||||
from sitegen.config import DATA_LICENSE, REPO_URL, build_commit, data_timestamp
|
||||
from sitegen.config import DATA_LICENSE, REPO_URL, build_commit
|
||||
from core.paths import REPO_ROOT
|
||||
from sitegen.install import release_pack_platforms
|
||||
from sitegen.lookup import (
|
||||
@@ -510,7 +511,7 @@ def _write_sqlite_export(
|
||||
commit = source_commit()
|
||||
metadata = {
|
||||
"schema_version": "1",
|
||||
"generated_at": str(db.get("generated_at") or data_timestamp()),
|
||||
"generated_at": build_timestamp(db),
|
||||
**({"commit": commit} if commit else {}),
|
||||
"source": REPO_URL,
|
||||
"scope": "metadata only, no BIOS or firmware payload bytes",
|
||||
@@ -690,7 +691,7 @@ def generate_data_exports(
|
||||
for directory in (api, downloads, schemas_dest):
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
generated_at = str(db.get("generated_at") or data_timestamp())
|
||||
generated_at = build_timestamp(db)
|
||||
# The revision the data was read at: a tool comparing two downloads
|
||||
# could not tell which commit each came from.
|
||||
commit = source_commit()
|
||||
|
||||
@@ -5,12 +5,13 @@ from __future__ import annotations
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
from core.artifacts import build_timestamp
|
||||
from model import releaserecord
|
||||
from model import siteinputs
|
||||
from model.composition import count_catalog_matched
|
||||
from model.platforms import load_platform_config
|
||||
from model.profiles import unique_emulator_profiles
|
||||
from sitegen.config import RELEASE_URL, REPO_URL, data_timestamp
|
||||
from sitegen.config import RELEASE_URL, REPO_URL
|
||||
|
||||
|
||||
def compute_stats(db: dict, coverages: dict, profiles: dict) -> dict:
|
||||
@@ -20,7 +21,7 @@ def compute_stats(db: dict, coverages: dict, profiles: dict) -> dict:
|
||||
systems.update(p.get("systems", []))
|
||||
return {
|
||||
"schema_version": 1,
|
||||
"generated_at": data_timestamp(),
|
||||
"generated_at": build_timestamp(),
|
||||
"files": db.get("total_files", 0),
|
||||
"size_bytes": db.get("total_size", 0),
|
||||
"platforms": len(coverages),
|
||||
|
||||
@@ -710,7 +710,7 @@ class EveryEnvelopeCarriesTheCommit(unittest.TestCase):
|
||||
|
||||
def test_the_writers_pass_it(self):
|
||||
source = script_source("generate_site.py")
|
||||
self.assertIn('str(db.get("generated_at") or data_timestamp()), source_commit(),\n )\n'
|
||||
self.assertIn('build_timestamp(db), source_commit(),\n )\n'
|
||||
" clash", source)
|
||||
block = source[source.index("public_profiles = {"):source.index("pages = emulator_pages(")]
|
||||
self.assertIn("write_single_item(", block)
|
||||
|
||||
Reference in new issue
Block a user