mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
generate_db, generate_games_index, download, romset_recipes, validate_pr and list_platforms keep only main and build_parser: the database build goes to collection.run, the games index run to games.run, the pack info and its no-pack message to release.packinfo, the capture and build runs to romrecipes.runs, the file selection to resolve.reviewfiles. Tests reach the moved code through those packages.
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Scan bios/ directory and generate multi-indexed database.json.
|
|
|
|
Usage:
|
|
python scripts/generate_db.py [--force] [--bios-dir DIR] [--output FILE]
|
|
|
|
Supports incremental mode via .cache/db_cache.json (mtime-based).
|
|
Use --force to rehash all files.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
from core.cli import add_repo_inputs, require_directory
|
|
from model.dumpcatalog import DEFAULT_PROVENANCE_DIR
|
|
from core.artifacts import repository_output_lock
|
|
from model.safeparse import require_yaml
|
|
from collection.run import generate
|
|
|
|
# Platform and profile aliases are read from YAML: without pyyaml the
|
|
# database lost every one of them and the run still exited 0.
|
|
yaml = require_yaml()
|
|
|
|
DEFAULT_OUTPUT = "database.json"
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(allow_abbrev=False, description="Generate multi-indexed BIOS database")
|
|
parser.add_argument("--force", action="store_true", help="Force rehash all files")
|
|
add_repo_inputs(parser, "bios")
|
|
parser.add_argument(
|
|
"--output", "-o", default=DEFAULT_OUTPUT, help="Output JSON file"
|
|
)
|
|
parser.add_argument(
|
|
"--provenance-dir",
|
|
default=DEFAULT_PROVENANCE_DIR,
|
|
help="Directory with dump-catalog snapshots",
|
|
)
|
|
args = parser.parse_args()
|
|
require_directory(args.bios_dir)
|
|
with repository_output_lock(args.output):
|
|
return generate(args)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
from core.cli import run_cli
|
|
|
|
run_cli(main)
|