From 01c9206298215189af2a3abbc8801a4b84e2c023 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Tue, 16 Aug 2022 22:07:57 -0700 Subject: [PATCH 1/2] gpgme: respect the doCheck parameter The current `gpgme` expression ignores the `doCheck` parameter because upstream's `Makefile` runs the tests automatically as part of the `buildPhase`. Let's run the tests as part of the `checkPhase` iff `doCheck` is set, like the rest of nixpkgs' packages. In particular, with this commit, `pkgsCross.*.gpgme` will no longer attempt to run the tests (tests are not supposed to be run when host!=build). --- pkgs/development/libraries/gpgme/default.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix index 079caf85da9e5e5..f5b5d5b63cf3382 100644 --- a/pkgs/development/libraries/gpgme/default.nix +++ b/pkgs/development/libraries/gpgme/default.nix @@ -95,12 +95,7 @@ stdenv.mkDerivation rec { "--enable-fixed-path=${gnupg}/bin" "--with-libgpg-error-prefix=${libgpg-error.dev}" "--with-libassuan-prefix=${libassuan.dev}" - ] ++ lib.optional pythonSupport "--enable-languages=python" - # Tests will try to communicate with gpg-agent instance via a UNIX socket - # which has a path length limit. Nix on darwin is using a build directory - # that already has quite a long path and the resulting socket path doesn't - # fit in the limit. https://github.com/NixOS/nix/pull/1085 - ++ lib.optionals stdenv.isDarwin [ "--disable-gpg-test" ]; + ] ++ lib.optional pythonSupport "--enable-languages=python"; NIX_CFLAGS_COMPILE = toString ( # qgpgme uses Q_ASSERT which retains build inputs at runtime unless @@ -110,7 +105,16 @@ stdenv.mkDerivation rec { ++ lib.optional stdenv.hostPlatform.is32bit "-D_FILE_OFFSET_BITS=64" ); - doCheck = true; + # prevent tests from being run during the buildPhase + makeFlags = [ "tests=" ]; + + # Tests will try to communicate with gpg-agent instance via a UNIX socket + # which has a path length limit. Nix on darwin is using a build directory + # that already has quite a long path and the resulting socket path doesn't + # fit in the limit. https://github.com/NixOS/nix/pull/1085 + doCheck = !stdenv.isDarwin; + + checkFlags = [ "-C" "tests" ]; passthru.tests = { python = python3.pkgs.gpgme; From 1519ec7298957347cdf8ccde9609f9776c6c97b1 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 17 Aug 2022 10:26:30 -0700 Subject: [PATCH 2/2] gpgme: on Darwin, disable only the gpg-test, not the others --- pkgs/development/libraries/gpgme/default.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix index f5b5d5b63cf3382..6023304cbf8e9dd 100644 --- a/pkgs/development/libraries/gpgme/default.nix +++ b/pkgs/development/libraries/gpgme/default.nix @@ -95,7 +95,12 @@ stdenv.mkDerivation rec { "--enable-fixed-path=${gnupg}/bin" "--with-libgpg-error-prefix=${libgpg-error.dev}" "--with-libassuan-prefix=${libassuan.dev}" - ] ++ lib.optional pythonSupport "--enable-languages=python"; + ] ++ lib.optional pythonSupport "--enable-languages=python" + # Tests will try to communicate with gpg-agent instance via a UNIX socket + # which has a path length limit. Nix on darwin is using a build directory + # that already has quite a long path and the resulting socket path doesn't + # fit in the limit. https://github.com/NixOS/nix/pull/1085 + ++ lib.optionals stdenv.isDarwin [ "--disable-gpg-test" ]; NIX_CFLAGS_COMPILE = toString ( # qgpgme uses Q_ASSERT which retains build inputs at runtime unless @@ -108,11 +113,7 @@ stdenv.mkDerivation rec { # prevent tests from being run during the buildPhase makeFlags = [ "tests=" ]; - # Tests will try to communicate with gpg-agent instance via a UNIX socket - # which has a path length limit. Nix on darwin is using a build directory - # that already has quite a long path and the resulting socket path doesn't - # fit in the limit. https://github.com/NixOS/nix/pull/1085 - doCheck = !stdenv.isDarwin; + doCheck = true; checkFlags = [ "-C" "tests" ];