mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 21:43:23 -05:00
fix: stop a check that cannot answer exiting zero
This commit is contained in:
1 parent
1c976390d7
commit
6d97fbe127
5 files changed
+129
-7
No files matched your search
@@ -196,6 +196,11 @@ def main() -> None:
|
||||
if args.update:
|
||||
update_changed(report)
|
||||
|
||||
# Unreachable upstream means the freshness question was not answered, and
|
||||
# a zero exit says it was answered "fresh".
|
||||
if report.get("error"):
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -11,6 +11,7 @@ import functools
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
@@ -930,10 +931,21 @@ def load_emulator_profiles(
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
# Every consumer reads {} as "this repo documents no emulator", which
|
||||
# is what a broken install looks like from the outside: zero coverage,
|
||||
# no gap, nothing to fix.
|
||||
print(
|
||||
"warning: pyyaml is not installed, no emulator profile was loaded",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return {}
|
||||
profiles = {}
|
||||
emu_path = Path(emulators_dir)
|
||||
if not emu_path.exists():
|
||||
print(
|
||||
f"warning: no emulator profile directory at {emulators_dir}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return profiles
|
||||
for f in sorted(emu_path.glob("*.yml")):
|
||||
if f.name.endswith(".old.yml"):
|
||||
|
||||
@@ -2134,6 +2134,11 @@ def _run_verify_packs(args):
|
||||
break
|
||||
if not zip_path:
|
||||
print(f" {platform_name}: SKIP (no pack in {args.output_dir})")
|
||||
# Naming a platform is asking about its pack. Answering SKIP and
|
||||
# exiting 0 says the pack passed; with --all, a platform whose pack
|
||||
# was not built is genuinely out of scope.
|
||||
if args.platform:
|
||||
all_ok = False
|
||||
continue
|
||||
|
||||
if _narrows_contents(os.path.basename(zip_path)):
|
||||
|
||||
@@ -52,27 +52,39 @@ def index_cache(cache_dir: str) -> dict[str, str]:
|
||||
return index
|
||||
|
||||
|
||||
def restore(cache_dir: str, db_path: str, gitignore: str) -> int:
|
||||
def restore(
|
||||
cache_dir: str, db_path: str, gitignore: str
|
||||
) -> tuple[int, list[str]]:
|
||||
if not os.path.isdir(cache_dir):
|
||||
print(f"No cache at {cache_dir}, nothing to restore")
|
||||
return 0
|
||||
return 0, []
|
||||
ignored = gitignored_paths(gitignore)
|
||||
index = index_cache(cache_dir)
|
||||
db = load_database(db_path)
|
||||
restored = 0
|
||||
unsatisfied: list[str] = []
|
||||
for sha1, entry in db.get("files", {}).items():
|
||||
path = entry.get("path", "")
|
||||
if path not in ignored or os.path.exists(path):
|
||||
continue
|
||||
source = index.get(sha1)
|
||||
if not source:
|
||||
unsatisfied.append(path)
|
||||
continue
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
shutil.copy2(source, path)
|
||||
print(f"Restored: {path}")
|
||||
restored += 1
|
||||
print(f"Total: {restored} files restored")
|
||||
return restored
|
||||
if unsatisfied:
|
||||
# Every consumer downstream resolves against the disk, so a path the
|
||||
# cache cannot supply is not a smaller restore: it drops entries from
|
||||
# the manifest and inflates the missing count the README publishes.
|
||||
print(f"Unsatisfied: {len(unsatisfied)} declared paths the cache "
|
||||
"cannot supply", file=sys.stderr)
|
||||
for path in sorted(unsatisfied)[:10]:
|
||||
print(f" {path}", file=sys.stderr)
|
||||
return restored, unsatisfied
|
||||
|
||||
|
||||
def main() -> None:
|
||||
@@ -81,7 +93,9 @@ def main() -> None:
|
||||
parser.add_argument("--db", default="database.json")
|
||||
parser.add_argument("--gitignore", default=".gitignore")
|
||||
args = parser.parse_args()
|
||||
restore(args.cache, args.db, args.gitignore)
|
||||
_restored, unsatisfied = restore(args.cache, args.db, args.gitignore)
|
||||
if unsatisfied:
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user