From 32964dd23d1b5522015e0c9d5134ff2542156a16 Mon Sep 17 00:00:00 2001 From: Alexandre Macabies Date: Mon, 27 Jun 2022 00:20:04 +0200 Subject: [PATCH] pykms: switch to maintained fork, fix PYTHONPATH, add test I have read the full diff[0] between the previous owner and the new maintained fork that I'm switching to, and could not find any suspicious code. The new fork includes fixes that are otherwise crashing as of Python 3.10. This commit also fixes the PYTHONPATH which prevents the client from starting. This commit also adds a test that the client can successfully query the server, testing the two components at once. [0] https://github.com/SystemRage/py-kms/compare/master...Py-KMS-Organization:master --- nixos/tests/all-tests.nix | 1 + nixos/tests/pykms.nix | 14 ++++++++++++++ pkgs/tools/networking/pykms/default.nix | 17 ++++++++++------- 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 nixos/tests/pykms.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 87bed40eac9e..e625fa7f2c28 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -458,6 +458,7 @@ in { proxy = handleTest ./proxy.nix {}; prowlarr = handleTest ./prowlarr.nix {}; pt2-clone = handleTest ./pt2-clone.nix {}; + pykms = handleTest ./pykms.nix {}; public-inbox = handleTest ./public-inbox.nix {}; pulseaudio = discoverTests (import ./pulseaudio.nix); qboot = handleTestOn ["x86_64-linux" "i686-linux"] ./qboot.nix {}; diff --git a/nixos/tests/pykms.nix b/nixos/tests/pykms.nix new file mode 100644 index 000000000000..14d776a2f113 --- /dev/null +++ b/nixos/tests/pykms.nix @@ -0,0 +1,14 @@ +import ./make-test-python.nix ({ pkgs, ... }: + { + name = "pykms-test"; + meta.maintainers = with pkgs.lib.maintainers; [ zopieux ]; + + nodes.machine = { config, lib, pkgs, ... }: { + services.pykms.enable = true; + }; + + testScript = '' + machine.wait_for_unit("pykms.service") + machine.succeed("${pkgs.pykms}/bin/client") + ''; + }) diff --git a/pkgs/tools/networking/pykms/default.nix b/pkgs/tools/networking/pykms/default.nix index d648ff3ec1ed..fac532110d2f 100644 --- a/pkgs/tools/networking/pykms/default.nix +++ b/pkgs/tools/networking/pykms/default.nix @@ -37,15 +37,15 @@ pypkgs.buildPythonApplication rec { version = "unstable-2021-01-25"; src = fetchFromGitHub { - owner = "SystemRage"; + owner = "Py-KMS-Organization"; repo = "py-kms"; - rev = "a3b0c85b5b90f63b33dfa5ae6085fcd52c6da2ff"; - sha256 = "sha256-u0R0uJMQxHnJUDenxglhQkZza3/1DcyXCILcZVceygA="; + rev = "1435c86fe4f11aa7fd42d77fa61715ca3015eeab"; + hash = "sha256-9KiMbS0uKTbWSZVIv5ziIeR9c8+EKfKd20yPmjCX7GQ="; }; sourceRoot = "source/py-kms"; - propagatedBuildInputs = with pypkgs; [ systemd pytz tzlocal ]; + propagatedBuildInputs = with pypkgs; [ systemd pytz tzlocal dnspython ]; postPatch = '' siteDir=$out/${python3.sitePackages} @@ -64,11 +64,14 @@ pypkgs.buildPythonApplication rec { mkdir -p $siteDir + PYTHONPATH="$PYTHONPATH:$siteDir" + mv * $siteDir for b in Client Server ; do makeWrapper ${python3.interpreter} $out/bin/''${b,,} \ --argv0 pykms-''${b,,} \ - --add-flags $siteDir/pykms_$b.py + --add-flags $siteDir/pykms_$b.py \ + --set PYTHONPATH $PYTHONPATH done install -Dm755 ${dbScript} $out/libexec/create_pykms_db.sh @@ -82,8 +85,8 @@ pypkgs.buildPythonApplication rec { meta = with lib; { description = "Windows KMS (Key Management Service) server written in Python"; - homepage = "https://github.com/SystemRage/py-kms"; + homepage = "https://github.com/Py-KMS-Organization/py-kms"; license = licenses.unlicense; - maintainers = with maintainers; [ peterhoeg ]; + maintainers = with maintainers; [ peterhoeg zopieux ]; }; }