diff options
author | Thiago Kenji Okada <thiagokokada@gmail.com> | 2021-11-15 00:39:57 -0300 |
---|---|---|
committer | Thiago Kenji Okada <thiagokokada@gmail.com> | 2021-11-17 12:00:35 -0300 |
commit | 8b122f950c1d48b1d0ba500f48ba20a4c52f6370 (patch) | |
tree | d85e04659699467eec530494050bf5a90e0d6d59 /pkgs/misc | |
parent | 14b2e99b33e31d0d366a9150c94dd43ce256ba96 (diff) | |
download | nixpkgs-8b122f950c1d48b1d0ba500f48ba20a4c52f6370.tar nixpkgs-8b122f950c1d48b1d0ba500f48ba20a4c52f6370.tar.gz nixpkgs-8b122f950c1d48b1d0ba500f48ba20a4c52f6370.tar.bz2 nixpkgs-8b122f950c1d48b1d0ba500f48ba20a4c52f6370.tar.lz nixpkgs-8b122f950c1d48b1d0ba500f48ba20a4c52f6370.tar.xz nixpkgs-8b122f950c1d48b1d0ba500f48ba20a4c52f6370.tar.zst nixpkgs-8b122f950c1d48b1d0ba500f48ba20a4c52f6370.zip |
libretro: add update.py script
Diffstat (limited to 'pkgs/misc')
-rwxr-xr-x | pkgs/misc/emulators/retroarch/update.py | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/pkgs/misc/emulators/retroarch/update.py b/pkgs/misc/emulators/retroarch/update.py new file mode 100755 index 00000000000..c562ff61173 --- /dev/null +++ b/pkgs/misc/emulators/retroarch/update.py @@ -0,0 +1,136 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ requests nix-prefetch-github ])" -p "git" + +import json +import sys +from pathlib import Path + +from nix_prefetch_github import nix_prefetch_github + +SCRIPT_PATH = Path(__file__).absolute().parent +HASHES_PATH = SCRIPT_PATH / "hashes.json" +CORES = { + "atari800": {"repo": "libretro-atari800"}, + "beetle-snes": {"repo": "beetle-bsnes-libretro"}, + "beetle-gba": {"repo": "beetle-gba-libretro"}, + "beetle-lynx": {"repo": "beetle-lynx-libretro"}, + "beetle-ngp": {"repo": "beetle-ngp-libretro"}, + "beetle-pce-fast": {"repo": "beetle-pce-fast-libretro"}, + "beetle-pcfx": {"repo": "beetle-pcfx-libretro"}, + "beetle-psx": {"repo": "beetle-psx-libretro"}, + "beetle-saturn": {"repo": "beetle-saturn-libretro"}, + "beetle-supergrafx": {"repo": "beetle-supergrafx-libretro"}, + "beetle-wswan": {"repo": "beetle-wswan-libretro"}, + "beetle-vb": {"repo": "beetle-vb-libretro"}, + "bluemsx": {"repo": "bluemsx-libretro"}, + "bsnes-mercury": {"repo": "bsnes-mercury"}, + "citra": {"repo": "citra", "fetch_submodules": True}, + "desmume": {"repo": "desmume"}, + "desmume2015": {"repo": "desmume2015"}, + "dolphin": {"repo": "dolphin"}, + "dosbox": {"repo": "dosbox-libretro"}, + "eightyone": {"repo": "81-libretro"}, + "fbalpha2012": {"repo": "fbalpha2012"}, + "fbneo": {"repo": "fbneo"}, + "fceumm": {"repo": "libretro-fceumm"}, + "flycast": {"repo": "flycast"}, + "fmsx": {"repo": "fmsx-libretro"}, + "freeintv": {"repo": "freeintv"}, + "gambatte": {"repo": "gambatte-libretro"}, + "genesis-plus-gx": {"repo": "Genesis-Plus-GX"}, + "gpsp": {"repo": "gpsp"}, + "gw": {"repo": "gw-libretro"}, + "handy": {"repo": "libretro-handy"}, + "hatari": {"repo": "hatari"}, + "mame": {"repo": "mame"}, + "mame2000": {"repo": "mame2000-libretro"}, + "mame2003": {"repo": "mame2003-libretro"}, + "mame2003-plus": {"repo": "mame2003-plus-libretro"}, + "mame2010": {"repo": "mame2010-libretro"}, + "mame2015": {"repo": "mame2015-libretro"}, + "mame2016": {"repo": "mame2016-libretro"}, + "mesen": {"repo": "mesen", "owner": "SourMesen"}, + "meteor": {"repo": "meteor-libretro"}, + "mgba": {"repo": "mgba"}, + "mupen64plus": {"repo": "mupen64plus-libretro-nx"}, + "neocd": {"repo": "neocd_libretro"}, + "nestopia": {"repo": "nestopia"}, + "np2kai": {"repo": "NP2kai", "owner": "AZO234", "fetch_submodules": True}, + "o2em": {"repo": "libretro-o2em"}, + "opera": {"repo": "opera-libretro"}, + "parallel-n64": {"repo": "parallel-n64"}, + "pcsx_rearmed": {"repo": "pcsx_rearmed"}, + "picodrive": {"repo": "picodrive", "fetch_submodules": True}, + "play": {"repo": "Play-", "fetch_submodules": True}, + "ppsspp": {"repo": "ppsspp", "owner": "hrydgard", "fetch_submodules": True}, + "prboom": {"repo": "libretro-prboom"}, + "prosystem": {"repo": "prosystem-libretro"}, + "quicknes": {"repo": "QuickNES_Core"}, + "sameboy": {"repo": "sameboy"}, + "scummvm": {"repo": "scummvm"}, + "smsplus-gx": {"repo": "smsplus-gx"}, + "snes9x": {"repo": "snes9x", "owner": "snes9xgit"}, + "snes9x2002": {"repo": "snes9x2002"}, + "snes9x2005": {"repo": "snes9x2005"}, + "snes9x2010": {"repo": "snes9x2010"}, + "stella": {"repo": "stella", "owner": "stella-emu"}, + "stella2014": {"repo": "stella2014-libretro"}, + "tgbdual": {"repo": "tgbdual-libretro"}, + "thepowdertoy": {"repo": "ThePowderToy"}, + "tic80": {"repo": "tic-80", "fetch_submodules": True}, + "vba-next": {"repo": "vba-next"}, + "vba-m": {"repo": "vbam-libretro"}, + "vecx": {"repo": "libretro-vecx"}, + "virtualjaguar": {"repo": "virtualjaguar-libretro"}, + "yabause": {"repo": "yabause"}, +} + + +def info(*msg): + print(*msg, file=sys.stderr) + + +def get_repo_hash_fetchFromGitHub(repo, owner="libretro", fetch_submodules=False): + assert repo is not None, "Parameter 'repo' can't be None." + + repo_hash = nix_prefetch_github( + owner=owner, repo=repo, fetch_submodules=fetch_submodules + ) + return { + "owner": repo_hash.repository.owner, + "repo": repo_hash.repository.name, + "rev": repo_hash.rev, + "sha256": repo_hash.sha256, + "fetchSubmodules": repo_hash.fetch_submodules, + } + + +def get_repo_hash(fetcher="fetchFromGitHub", **kwargs): + if fetcher == "fetchFromGitHub": + return get_repo_hash_fetchFromGitHub(**kwargs) + else: + raise ValueError(f"Unsupported fetcher: {fetcher}") + + +def get_repo_hashes(): + repo_hashes = {} + + for core, repo in CORES.items(): + info( + f"Getting repo hash for '{core}'...", + ) + repo_hashes[core] = get_repo_hash(**repo) + + return repo_hashes + + +def main(): + repo_hashes = get_repo_hashes() + info(f"Generating '{HASHES_PATH}'...") + with open(HASHES_PATH, "w") as f: + f.write(json.dumps(repo_hashes, indent=4)) + info("Finished!") + + +if __name__ == "__main__": + main() |