From 10ac9199553f17ad22e5f92e37e329126d6de951 Mon Sep 17 00:00:00 2001 From: Jason Yundt Date: Sat, 17 Feb 2024 20:55:58 -0500 Subject: [PATCH] ecwolf: add passthru.updateScript Before this change, nixpkgs-update had to rely on on Repology in order to determine if there was an ECWolf update. When it comes to ECWolf updates, Repology is a tertiary source of information. This change allows nixpkgs-update (and any other tools) to use debian.drdteam.org to determine if there is an ECWolf update. When it comes to ECWolf updates, debian.drdteam.org is a primary source of information. --- pkgs/games/ecwolf/default.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pkgs/games/ecwolf/default.nix b/pkgs/games/ecwolf/default.nix index 542b414d8a45..323edaa037d3 100644 --- a/pkgs/games/ecwolf/default.nix +++ b/pkgs/games/ecwolf/default.nix @@ -12,6 +12,9 @@ , SDL2_net , SDL2_mixer , gtk3 +, writers +, python3Packages +, nix-update }: stdenv.mkDerivation rec { @@ -41,6 +44,33 @@ stdenv.mkDerivation rec { makeWrapper $out/{Applications/ecwolf.app/Contents/MacOS,bin}/ecwolf ''; + passthru.updateScript = let + updateScriptPkg = writers.writePython3 "ecwolf_update_script" { + libraries = with python3Packages; [ debian-inspector requests ]; + } '' + from os import execl + from sys import argv + + from debian_inspector.debcon import get_paragraphs_data + from requests import get + + # The debian.drdteam.org repo is a primary source of information. It’s + # run by Blzut3, the creator and primary developer of ECWolf. It’s also + # listed on ECWolf’s download page: + # . + url = 'https://debian.drdteam.org/dists/stable/multiverse/binary-amd64/Packages' # noqa: E501 + response = get(url) + packages = get_paragraphs_data(response.text) + for package in packages: + if package['package'] == 'ecwolf': + latest_version = package['version'] + break + nix_update_path = argv[1] + + execl(nix_update_path, nix_update_path, '--version', latest_version) + ''; + in [ updateScriptPkg (lib.getExe nix-update) ]; + meta = with lib; { description = "Enhanched SDL-based port of Wolfenstein 3D for various platforms"; homepage = "https://maniacsvault.net/ecwolf/";