libretro.citra: remove nix-prefetch-github hack

This commit is contained in:
Thiago Kenji Okada 2022-01-02 19:03:54 -03:00
parent 3a5fd798dc
commit d83e270109
3 changed files with 27 additions and 25 deletions

View file

@ -306,13 +306,6 @@ in
citra = mkLibRetroCore { citra = mkLibRetroCore {
core = "citra"; core = "citra";
# `nix-prefetch-github` doesn't support `deepClone`, necessary for citra
# https://github.com/seppeljordan/nix-prefetch-github/issues/41
src = fetchFromGitHub {
inherit (hashesFile.citra) owner repo rev fetchSubmodules;
deepClone = true;
sha256 = "sha256-bwnYkMvbtRF5bGZRYVtMWxnCu9P45qeX4+ntOj9eRds=";
};
description = "Port of Citra to libretro"; description = "Port of Citra to libretro";
license = lib.licenses.gpl2Plus; license = lib.licenses.gpl2Plus;
extraNativeBuildInputs = [ cmake pkg-config ]; extraNativeBuildInputs = [ cmake pkg-config ];

View file

@ -122,8 +122,10 @@
"owner": "libretro", "owner": "libretro",
"repo": "citra", "repo": "citra",
"rev": "b1959d07a340bfd9af65ad464fd19eb6799a96ef", "rev": "b1959d07a340bfd9af65ad464fd19eb6799a96ef",
"sha256": "Tw6Niba9gsZOMKGaXF9AZ5gdigB0mmFyqoRTMElM/Ps=", "sha256": "bwnYkMvbtRF5bGZRYVtMWxnCu9P45qeX4+ntOj9eRds=",
"fetchSubmodules": true "fetchSubmodules": true,
"leaveDotGit": true,
"deepClone": true
}, },
"desmume": { "desmume": {
"owner": "libretro", "owner": "libretro",

View file

@ -1,12 +1,11 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ requests nix-prefetch-github ])" -p "git" #!nix-shell -I nixpkgs=../../../../ -i python3 -p "python3.withPackages (ps: with ps; [ requests nix-prefetch-github ])" -p "git"
import json import json
import sys import sys
import subprocess
from pathlib import Path from pathlib import Path
from nix_prefetch_github import nix_prefetch_github
SCRIPT_PATH = Path(__file__).absolute().parent SCRIPT_PATH = Path(__file__).absolute().parent
HASHES_PATH = SCRIPT_PATH / "hashes.json" HASHES_PATH = SCRIPT_PATH / "hashes.json"
CORES = { CORES = {
@ -27,7 +26,7 @@ CORES = {
"bsnes": {"repo": "bsnes-libretro"}, "bsnes": {"repo": "bsnes-libretro"},
"bsnes-hd": {"repo": "bsnes-hd", "owner": "DerKoun"}, "bsnes-hd": {"repo": "bsnes-hd", "owner": "DerKoun"},
"bsnes-mercury": {"repo": "bsnes-mercury"}, "bsnes-mercury": {"repo": "bsnes-mercury"},
"citra": {"repo": "citra", "fetch_submodules": True}, "citra": {"repo": "citra", "fetch_submodules": True, "deep_clone": True, "leave_dot_git": True},
"desmume": {"repo": "desmume"}, "desmume": {"repo": "desmume"},
"desmume2015": {"repo": "desmume2015"}, "desmume2015": {"repo": "desmume2015"},
"dolphin": {"repo": "dolphin"}, "dolphin": {"repo": "dolphin"},
@ -97,19 +96,27 @@ def info(*msg):
print(*msg, file=sys.stderr) print(*msg, file=sys.stderr)
def get_repo_hash_fetchFromGitHub(repo, owner="libretro", fetch_submodules=False): def get_repo_hash_fetchFromGitHub(
assert repo is not None, "Parameter 'repo' can't be None." repo,
owner="libretro",
repo_hash = nix_prefetch_github( deep_clone=False,
owner=owner, repo=repo, fetch_submodules=fetch_submodules fetch_submodules=False,
leave_dot_git=False,
):
extra_args = []
if deep_clone:
extra_args.append("--deep-clone")
if fetch_submodules:
extra_args.append("--fetch-submodules")
if leave_dot_git:
extra_args.append("--leave-dot-git")
result = subprocess.run(
["nix-prefetch-github", owner, repo, *extra_args],
check=True,
capture_output=True,
text=True,
) )
return { return json.loads(result.stdout)
"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): def get_repo_hash(fetcher="fetchFromGitHub", **kwargs):