Merge pull request #153401 from thiagokokada/retroarch-improvements

libretro.citra: remove nix-prefetch-github hack
This commit is contained in:
Thiago Kenji Okada 2022-01-04 17:48:08 -03:00 committed by GitHub
commit cf9dbdbe03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 30 deletions

View file

@ -54,7 +54,7 @@ let
, description
# Check https://github.com/libretro/libretro-core-info for license information
, license
, src ? null
, src ? (getCoreSrc core)
, broken ? false
, version ? "unstable-2021-12-06"
, platforms ? retroarch.meta.platforms
@ -63,15 +63,13 @@ let
, normalizeCore ? true
, ...
}@args:
lib.makeOverridable stdenv.mkDerivation (
stdenv.mkDerivation (
let
d2u = if normalizeCore then (lib.replaceChars [ "-" ] [ "_" ]) else (x: x);
finalSrc = if src == null then getCoreSrc core else src;
in
(rec {
pname = "libretro-${core}";
inherit version;
src = finalSrc;
inherit version src;
buildInputs = [ zlib ] ++ args.extraBuildInputs or [ ];
nativeBuildInputs = [ makeWrapper ] ++ args.extraNativeBuildInputs or [ ];
@ -308,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):