mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-24 04:39:06 -05:00
fix: make maintainer tool output actionable
--emulator accepts a buildbot core name from a profile's cores:, and a mistyped target gets the closest names instead of every target. diff_truth shows destinations and reports unpaired entries as evidence, not removals. The verify summary counts discrepancies, a shared destination names both systems, a truth hash conflict names both cores, and pipeline steps carry their place in the real run instead of N/8. Every GitHub API caller takes the token from github_token(), which falls back to gh auth token.
This commit is contained in:
1 parent
6ee138a819
commit
7095aa61e7
29 files changed
+764
-154
No files matched your search
@@ -3,7 +3,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
@@ -16,7 +15,7 @@ from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Callable, NoReturn
|
||||
|
||||
from common import write_text_atomic, yaml_load
|
||||
from common import github_token, write_text_atomic, yaml_load
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -273,7 +272,8 @@ def github_headers() -> dict[str, str]:
|
||||
"User-Agent": "retrobios-scraper/1.0",
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
}
|
||||
token = os.environ.get("GITHUB_TOKEN")
|
||||
# GITHUB_TOKEN, else the token gh is logged in with.
|
||||
token = github_token()
|
||||
if token:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
return headers
|
||||
@@ -338,10 +338,11 @@ def _exit_on_scrape_error(error: Exception) -> NoReturn:
|
||||
"""Print what failed and what to try, then exit 1 without a traceback."""
|
||||
print(f"Error: {error}", file=sys.stderr)
|
||||
refused = re.search(r"\b(403|429)\b|rate limit", str(error), re.I)
|
||||
if refused and not os.environ.get("GITHUB_TOKEN"):
|
||||
if refused and not github_token():
|
||||
# A gh login is read on its own, so the hint is the login itself.
|
||||
print(
|
||||
"Anonymous GitHub API calls are limited to 60 an hour. "
|
||||
"Run again with GITHUB_TOKEN=$(gh auth token) set.",
|
||||
"Log in with `gh auth login`, or set GITHUB_TOKEN, and run again.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
else:
|
||||
|
||||
@@ -20,7 +20,7 @@ from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from common import source_yaml_paths, write_text_atomic, yaml_load
|
||||
from common import github_token, source_yaml_paths, write_text_atomic, yaml_load
|
||||
|
||||
from scripts.scraper._hash_merge import compute_diff, merge_fbneo_profile
|
||||
from scripts.scraper.fbneo_parser import parse_fbneo_source_tree
|
||||
@@ -125,7 +125,7 @@ def _version_from_api() -> str:
|
||||
import urllib.request
|
||||
|
||||
headers = {"User-Agent": "retrobios-scraper/1.0"}
|
||||
token = os.environ.get("GITHUB_TOKEN")
|
||||
token = github_token()
|
||||
if token:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
req = urllib.request.Request(
|
||||
|
||||
@@ -22,7 +22,7 @@ from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from common import source_yaml_paths, write_text_atomic, yaml_load
|
||||
from common import github_token, source_yaml_paths, write_text_atomic, yaml_load
|
||||
|
||||
import upstream
|
||||
|
||||
@@ -144,7 +144,7 @@ def _get_release_tag() -> str:
|
||||
"User-Agent": "retrobios-scraper/1.0",
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
}
|
||||
token = os.environ.get("GITHUB_TOKEN")
|
||||
token = github_token()
|
||||
if token:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
url = "https://api.github.com/repos/mamedev/mame/releases/latest"
|
||||
|
||||
@@ -28,7 +28,6 @@ Verification logic (api_data_processing.sh:289-405):
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import urllib.error
|
||||
@@ -256,7 +255,9 @@ class Scraper(BaseScraper):
|
||||
|
||||
def _fetch_remote_manifests(self) -> list[tuple[str, dict]]:
|
||||
"""Fetch component manifests via GitHub API."""
|
||||
token = os.environ.get("GITHUB_TOKEN", "")
|
||||
from common import github_token # noqa: PLC0415
|
||||
|
||||
token = github_token()
|
||||
headers = {"User-Agent": "retrobios-scraper/1.0"}
|
||||
if token:
|
||||
headers["Authorization"] = f"token {token}"
|
||||
|
||||
@@ -9,7 +9,6 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import urllib.error
|
||||
@@ -18,7 +17,7 @@ from datetime import datetime, timezone
|
||||
|
||||
import yaml
|
||||
|
||||
from common import yaml_load
|
||||
from common import github_token, yaml_load
|
||||
|
||||
from . import BaseTargetScraper
|
||||
|
||||
@@ -51,7 +50,7 @@ _SKIP = {"retroarch_maincfg", "retroarch"}
|
||||
|
||||
def _fetch(url: str) -> str:
|
||||
headers = {"User-Agent": "retrobios-scraper/1.0"}
|
||||
token = os.environ.get("GITHUB_TOKEN")
|
||||
token = github_token()
|
||||
if token and "api.github.com" in url:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
try:
|
||||
|
||||
@@ -10,7 +10,6 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import urllib.error
|
||||
@@ -67,7 +66,9 @@ _MODULE_FLAGS_RE = re.compile(r'rp_module_flags\s*=\s*["\']([^"\']*)["\']')
|
||||
|
||||
def _fetch(url: str, accept: str = "text/plain") -> str:
|
||||
headers = {"User-Agent": "retrobios-scraper/1.0", "Accept": accept}
|
||||
token = os.environ.get("GITHUB_TOKEN")
|
||||
from common import github_token # noqa: PLC0415
|
||||
|
||||
token = github_token()
|
||||
if token and "api.github.com" in url:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user