Merge pull request #186683 from IvarWithoutBones/fix/yuzu-updater

yuzu-{ea,mainline}: {2901,1131} -> {2907,1137}
This commit is contained in:
adisbladis 2022-08-22 22:17:39 +08:00 committed by GitHub
commit 3cc0fc843c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 105 additions and 1267 deletions

View File

@ -5,23 +5,23 @@
}:
let
# Fetched from https://api.yuzu-emu.org/gamedb, last updated 2022-07-14
# Mirror of https://api.yuzu-emu.org/gamedb, last updated 2022-08-13
# Please make sure to update this when updating yuzu!
compat-list = fetchurl {
name = "yuzu-compat-list";
url = "https://web.archive.org/web/20220714160745/https://api.yuzu-emu.org/gamedb";
url = "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/d83401d2ee3fd5e1922e31baed1f3bdb1c0f036c/compatibility_list.json";
sha256 = "sha256-anOmO7NscHDsQxT03+YbJEyBkXjhcSVGgKpDwt//GHw=";
};
in {
mainline = libsForQt5.callPackage ./generic.nix rec {
pname = "yuzu-mainline";
version = "1131";
version = "1137";
src = fetchFromGitHub {
owner = "yuzu-emu";
repo = "yuzu-mainline";
rev = "mainline-0-${version}";
sha256 = "0lh8s59hrysfjz69yr0f44s3l4aaznmclq0xfnyblsk0cw9ripf6";
sha256 = "sha256-DLU5hmjTnlpRQ6sbcU7as/KeI9dDJAFUzVLciql5niE=";
fetchSubmodules = true;
};
@ -30,13 +30,13 @@ in {
early-access = libsForQt5.callPackage ./generic.nix rec {
pname = "yuzu-ea";
version = "2901";
version = "2907";
src = fetchFromGitHub {
owner = "pineappleEA";
repo = "pineapple-src";
rev = "EA-${version}";
sha256 = "0jymm9sdsnayjaffmcbpjck4k2yslx8zid2vsm4jfdaajr244q2z";
sha256 = "sha256-spPW2/qeVyd1P1/Z2lcuA69igS3xV4KtcJ59yf9X4JI=";
fetchSubmodules = true;
};

View File

@ -45,15 +45,6 @@
stdenv.mkDerivation rec {
inherit pname version src;
# Replace icons licensed under CC BY-ND 3.0 with free ones to allow
# for binary redistribution: https://github.com/yuzu-emu/yuzu/pull/8104
# The patch hosted on GitHub has the binary information in git format, which
# cant be applied with patch(1), so it has been regenerated with
# "git format-patch --text --full-index --binary".
# Because pineapple strips all files beginning with a dot, the patch needs to
# be edited manually afterwards to remove all changes to those.
patches = [ ./yuzu-free-icons.patch ];
nativeBuildInputs = [
cmake
doxygen
@ -111,6 +102,13 @@ stdenv.mkDerivation rec {
"-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically
];
qtWrapperArgs = [
# Fixes vulkan detection
"--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib"
# Without yuzu doesnt start on wayland. See https://github.com/yuzu-emu/yuzu/issues/6088
"--set QT_QPA_PLATFORM xcb"
];
preConfigure = ''
# This prevents a check for submodule directories.
rm -f .gitmodules
@ -127,13 +125,6 @@ stdenv.mkDerivation rec {
ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json
'';
# Fix vulkan detection
postFixup = ''
for bin in $out/bin/yuzu $out/bin/yuzu-cmd; do
wrapProgram $bin --prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib
done
'';
passthru.updateScript = runCommandLocal "yuzu-${branch}-updateScript" {
script = substituteAll {
src = ./update.sh;
@ -154,7 +145,7 @@ stdenv.mkDerivation rec {
platforms = [ "x86_64-linux" ];
license = with licenses; [
gpl3Plus
# Icons. Note that this would be cc0 and cc-by-nd-30 without the "yuzu-free-icons" patch
# Icons
asl20 mit cc0
];
maintainers = with maintainers; [

View File

@ -1,84 +1,105 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix nix-prefetch-git coreutils curl jq gnused
#! nix-shell -I nixpkgs=./. -i bash -p nix nix-prefetch-git coreutils curl jq gnused
set -e
set -euo pipefail
# Will be replaced with the actual branch when running this from passthru.updateScript
BRANCH="@branch@"
DEFAULT_NIX="$(dirname "${BASH_SOURCE[@]}")/default.nix"
if [[ ! "$(basename $PWD)" = "yuzu" ]]; then
echo "error: Script must be ran from yuzu's directory!"
if [[ "$(basename "$PWD")" = "yuzu" ]]; then
echo "error: Script must be ran from nixpkgs's root directory for compatibility with the maintainer script"
exit 1
fi
getLocalVersion() {
pushd ../../../.. >/dev/null
nix eval --raw -f default.nix "$1".version
popd >/dev/null
}
updateBranch() {
local branch attribute oldVersion oldHash newVersion newHash
branch="$1"
attribute="yuzu-$branch"
[[ "$branch" = "early-access" ]] && attribute="yuzu-ea" # Attribute path doesnt match the branch name
oldVersion="$(nix eval --raw -f "./default.nix" "$attribute".version)"
oldHash="$(nix eval --raw -f "./default.nix" "$attribute".src.drvAttrs.outputHash)"
getLocalHash() {
pushd ../../../.. >/dev/null
nix eval --raw -f default.nix "$1".src.drvAttrs.outputHash
popd >/dev/null
}
updateMainline() {
OLD_MAINLINE_VERSION="$(getLocalVersion "yuzu-mainline")"
OLD_MAINLINE_HASH="$(getLocalHash "yuzu-mainline")"
NEW_MAINLINE_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
"https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" | jq -r '.[0].name' | cut -d" " -f2)"
if [[ "${OLD_MAINLINE_VERSION}" = "${NEW_MAINLINE_VERSION}" ]]; then
echo "yuzu-mainline is already up to date!"
[ "$KEEP_GOING" ] && return || exit
else
echo "yuzu-mainline: ${OLD_MAINLINE_VERSION} -> ${NEW_MAINLINE_VERSION}"
if [[ "$branch" = "mainline" ]]; then
newVersion="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" \
| jq -r '.[0].name' | cut -d" " -f2)"
elif [[ "$branch" = "early-access" ]]; then
newVersion="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=2" \
| jq -r '.[].tag_name' | grep '^EA-[0-9]*' | head -n1 | cut -d"-" -f2 | cut -d" " -f1)"
fi
echo " Fetching source code..."
NEW_MAINLINE_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "mainline-0-${NEW_MAINLINE_VERSION}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')"
echo " Succesfully fetched. hash: ${NEW_MAINLINE_HASH}"
sed -i "s/${OLD_MAINLINE_VERSION}/${NEW_MAINLINE_VERSION}/" ./default.nix
sed -i "s/${OLD_MAINLINE_HASH}/${NEW_MAINLINE_HASH}/" ./default.nix
}
updateEarlyAccess() {
OLD_EA_VERSION="$(getLocalVersion "yuzu-ea")"
OLD_EA_HASH="$(getLocalHash "yuzu-ea")"
NEW_EA_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
"https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=2" | jq -r '.[].tag_name' | grep '^EA-[0-9]*' | head -n1 | cut -d"-" -f2 | cut -d" " -f1)"
if [[ "${OLD_EA_VERSION}" = "${NEW_EA_VERSION}" ]]; then
echo "yuzu-ea is already up to date!"
[ "$KEEP_GOING" ] && return || exit
if [[ "${oldVersion}" = "${newVersion}" ]]; then
echo "$attribute is already up to date."
return
else
echo "yuzu-ea: ${OLD_EA_VERSION} -> ${NEW_EA_VERSION}"
echo "$attribute: ${oldVersion} -> ${newVersion}"
fi
echo " Fetching source code..."
echo " fetching source code to generate hash..."
if [[ "$branch" = "mainline" ]]; then
newHash="$(nix-prefetch-git --quiet --fetch-submodules --rev "mainline-0-${newVersion}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')"
elif [[ "$branch" = "early-access" ]]; then
newHash="$(nix-prefetch-git --quiet --fetch-submodules --rev "EA-${newVersion}" "https://github.com/pineappleEA/pineapple-src" | jq -r '.sha256')"
fi
newHash="$(nix hash to-sri --type sha256 "${newHash}")"
NEW_EA_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "EA-${NEW_EA_VERSION}" "https://github.com/pineappleEA/pineapple-src" | jq -r '.sha256')"
echo " Succesfully fetched. hash: ${NEW_EA_HASH}"
sed -i "s/${OLD_EA_VERSION}/${NEW_EA_VERSION}/" ./default.nix
sed -i "s/${OLD_EA_HASH}/${NEW_EA_HASH}/" ./default.nix
sed -i "s,${oldVersion},${newVersion}," "$DEFAULT_NIX"
sed -i "s,${oldHash},${newHash},g" "$DEFAULT_NIX"
echo " succesfully updated $attribute. new hash: $newHash"
}
if [[ "$BRANCH" = "mainline" ]]; then
updateMainline
elif [[ "$BRANCH" = "early-access" ]]; then
updateEarlyAccess
else
KEEP_GOING=1
updateMainline
updateEarlyAccess
updateCompatibilityList() {
local latestRevision oldUrl newUrl oldHash newHash oldDate newDate
latestRevision="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/master" | jq -r '.sha')"
oldUrl="$(sed -n '/yuzu-compat-list/,/url/p' "$DEFAULT_NIX" | tail -n1 | cut -d'"' -f2)"
newUrl="https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${latestRevision}/compatibility_list.json"
oldDate="$(sed -n '/last updated.*/p' "$DEFAULT_NIX" | rev | cut -d' ' -f1 | rev)"
newDate="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/${latestRevision}" \
| jq -r '.commit.committer.date' | cut -d'T' -f1)"
oldHash="$(sed -n '/yuzu-compat-list/,/sha256/p' "$DEFAULT_NIX" | tail -n1 | cut -d'"' -f2)"
newHash="$(nix hash to-sri --type sha256 "$(nix-prefetch-url --quiet "$newUrl")")"
if [[ "$oldHash" = "$newHash" ]]; then
echo "compatibility_list is already up to date."
return
else
echo "compatibility_list: $oldDate -> $newDate"
fi
sed -i "s,${oldUrl},${newUrl},g" "$DEFAULT_NIX"
sed -i "s,${oldHash},${newHash},g" "$DEFAULT_NIX"
sed -i "s,${oldDate},${newDate},g" "$DEFAULT_NIX"
echo " succesfully updated compatibility_list. new hash: $newHash"
}
if [[ "$BRANCH" = "mainline" ]] || [[ "$BRANCH" = "early-access" ]]; then
updateBranch "$BRANCH"
updateCompatibilityList
else # Script is not ran from passthru.updateScript
if (( $# == 0 )); then
updateBranch "mainline"
updateBranch "early-access"
fi
while (( "$#" > 0 )); do
case "$1" in
mainline|yuzu-mainline)
updateBranch "mainline"
;;
early-access|yuzu-early-access|ea|yuzu-ea)
updateBranch "early-access"
;;
*)
echo "error: invalid branch: $1."
echo "usage: $(basename "$0") [mainline|early-access]"
exit 1
;;
esac
shift
done
updateCompatibilityList
fi

File diff suppressed because it is too large Load Diff

View File

@ -1549,6 +1549,7 @@ mapAliases ({
youtubeDL = throw "'youtubeDL' has been renamed to/replaced by 'youtube-dl'"; # Converted to throw 2022-02-22
ytop = throw "ytop has been abandoned by upstream. Consider switching to bottom instead";
yubikey-neo-manager = throw "yubikey-neo-manager has been removed because it was broken. Use yubikey-manager-qt instead"; # Added 2021-03-08
yuzu-ea = yuzu-early-access; # Added 2022-08-18
yuzu = yuzu-mainline; # Added 2021-01-25
### Z ###

View File

@ -1656,12 +1656,14 @@ with pkgs;
### APPLICATIONS/EMULATORS/YUZU
yuzu-mainline = callPackage ../applications/emulators/yuzu {
yuzu-mainline = import ../applications/emulators/yuzu {
branch = "mainline";
inherit libsForQt5 fetchFromGitHub fetchurl;
};
yuzu-ea = callPackage ../applications/emulators/yuzu {
yuzu-early-access = import ../applications/emulators/yuzu {
branch = "early-access";
inherit libsForQt5 fetchFromGitHub fetchurl;
};
### APPLICATIONS/EMULATORS/COMMANDERX16