From d8816fb9493eba6bd8d6021cefd7a331de319c97 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Mon, 1 May 2023 22:07:20 +1200 Subject: [PATCH] gogdl: 0.4 -> 0.7.1 --- pkgs/games/gogdl/default.nix | 38 +++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/pkgs/games/gogdl/default.nix b/pkgs/games/gogdl/default.nix index 24a9667e679..25b30a00a2e 100644 --- a/pkgs/games/gogdl/default.nix +++ b/pkgs/games/gogdl/default.nix @@ -1,22 +1,23 @@ { lib -, gitUpdater +, writeScript , buildPythonApplication , fetchFromGitHub , pythonOlder , setuptools , requests +, cacert }: buildPythonApplication rec { pname = "gogdl"; - version = "0.4"; + version = "0.7.1"; format = "pyproject"; src = fetchFromGitHub { owner = "Heroic-Games-Launcher"; repo = "heroic-gogdl"; - rev = "refs/tags/v${version}"; - sha256 = "sha256-4hWuGd0Alzd/ZqtN4zG2aid6C9lnT3Ihrrsjfg9PEYA="; + rev = "8bfb965090153c946c616bb0f82e3dc432e0d0e1"; + sha256 = "sha256-ZdPyJk4WPVBtKMTf/AHNpG8QTV2qmpD1DT1D3gK5g2I="; }; disabled = pythonOlder "3.8"; @@ -35,7 +36,30 @@ buildPythonApplication rec { maintainers = with maintainers; [ aidalgol ]; }; - passthru.updateScript = gitUpdater { - rev-prefix = "v"; - }; + # Upstream no longer create git tags when bumping the version, so we have to + # extract it from the source code on the main branch. + passthru.updateScript = writeScript "gogdl-update-script" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl gnused jq common-updater-scripts + set -eou pipefail; + + owner=Heroic-Games-Launcher + repo=heroic-gogdl + path='gogdl/__init__.py' + + version=$( + curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \ + https://raw.githubusercontent.com/$owner/$repo/main/$path | + sed -n 's/^\s*version\s*=\s*"\([0-9]\.[0-9]\.[0-9]\)"\s*$/\1/p') + + commit=$(curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \ + https://api.github.com/repos/$owner/$repo/commits?path=$path | + jq -r '.[0].sha') + + update-source-version \ + ${pname} \ + "$version" \ + --file=./pkgs/games/gogdl/default.nix \ + --rev=$commit + ''; }