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 {
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";
license = lib.licenses.gpl2Plus;
extraNativeBuildInputs = [ cmake pkg-config ];

View file

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

View file

@ -1,12 +1,11 @@
#!/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 sys
import subprocess
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 = {
@ -27,7 +26,7 @@ CORES = {
"bsnes": {"repo": "bsnes-libretro"},
"bsnes-hd": {"repo": "bsnes-hd", "owner": "DerKoun"},
"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"},
"desmume2015": {"repo": "desmume2015"},
"dolphin": {"repo": "dolphin"},
@ -97,19 +96,27 @@ 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
def get_repo_hash_fetchFromGitHub(
repo,
owner="libretro",
deep_clone=False,
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 {
"owner": repo_hash.repository.owner,
"repo": repo_hash.repository.name,
"rev": repo_hash.rev,
"sha256": repo_hash.sha256,
"fetchSubmodules": repo_hash.fetch_submodules,
}
return json.loads(result.stdout)
def get_repo_hash(fetcher="fetchFromGitHub", **kwargs):