From fc720099b6e8cf7cddd4eb47b94139bff3282a57 Mon Sep 17 00:00:00 2001 From: Palmer Cox Date: Fri, 17 Jan 2025 22:28:02 -0500 Subject: [PATCH 1/5] thrift: 0.18.1 -> 0.21.0 I'm fetching from Github instead of the apache server since the release from apache.org appears to be missing the file "lib/cpp/test/Thrift5272.thrift". As such, it will not build. For reasons that are unclear, the mirror on github appears to have that file and will build. I remove all the patches since it appears to build on aarch64-darwin without the patches. I removed the disabled tests since it appears to build on aarch64-darwin (sandbox = true) without those tests being disabled. --- pkgs/by-name/th/thrift/package.nix | 73 +++--------------------------- 1 file changed, 7 insertions(+), 66 deletions(-) diff --git a/pkgs/by-name/th/thrift/package.nix b/pkgs/by-name/th/thrift/package.nix index 7b32a64faad9..785acd45774c 100644 --- a/pkgs/by-name/th/thrift/package.nix +++ b/pkgs/by-name/th/thrift/package.nix @@ -1,8 +1,8 @@ { lib, stdenv, - fetchurl, fetchpatch, + fetchFromGitHub, boost, zlib, libevent, @@ -17,11 +17,13 @@ stdenv.mkDerivation rec { pname = "thrift"; - version = "0.18.1"; + version = "0.21.0"; - src = fetchurl { - url = "https://archive.apache.org/dist/thrift/${version}/${pname}-${version}.tar.gz"; - hash = "sha256-BMbxDl14jKeOE+4u8NIVLHsHDAr1VIPWuULinP8pZyY="; + src = fetchFromGitHub { + owner = "apache"; + repo = "thrift"; + tag = "v0.21.0"; + hash = "sha256-OF/pFG8OXROsyYGf6jgfVTYTrTc8UB5QJh4gbostFfU="; }; # Workaround to make the Python wrapper not drop this package: @@ -58,46 +60,10 @@ stdenv.mkDerivation rec { zlib ]; - postPatch = '' - # Python 3.10 related failures: - # SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats - # AttributeError: module 'collections' has no attribute 'Hashable' - substituteInPlace test/py/RunClientServer.py \ - --replace "'FastbinaryTest.py'," "" \ - --replace "'TestEof.py'," "" \ - --replace "'TestFrozen.py'," "" - - # these functions are removed in Python3.12 - substituteInPlace test/py/SerializationTest.py \ - --replace-fail "assertEquals" "assertEqual" \ - --replace-fail "assertNotEquals" "assertNotEqual" - ''; - preConfigure = '' export PY_PREFIX=$out ''; - patches = [ - # ToStringTest.cpp is failing from some reason due to locale issue, this - # doesn't disable all UnitTests as in Darwin. - ./disable-failing-test.patch - (fetchpatch { - name = "setuptools-gte-62.1.0.patch"; # https://github.com/apache/thrift/pull/2635 - url = "https://github.com/apache/thrift/commit/c41ad9d5119e9bdae1746167e77e224f390f2c42.diff"; - hash = "sha256-FkErrg/6vXTomS4AsCsld7t+Iccc55ZiDaNjJ3W1km0="; - }) - (fetchpatch { - name = "thrift-install-FindLibevent.patch"; # https://github.com/apache/thrift/pull/2726 - url = "https://github.com/apache/thrift/commit/2ab850824f75d448f2ba14a468fb77d2594998df.diff"; - hash = "sha256-ejMKFG/cJgoPlAFzVDPI4vIIL7URqaG06/IWdQ2NkhY="; - }) - (fetchpatch { - name = "thrift-fix-tests-OpenSSL3.patch"; # https://github.com/apache/thrift/pull/2760 - url = "https://github.com/apache/thrift/commit/eae3ac418f36c73833746bcd53e69ed8a12f0e1a.diff"; - hash = "sha256-0jlN4fo94cfGFUKcLFQgVMI/x7uxn5OiLiFk6txVPzs="; - }) - ]; - cmakeFlags = [ "-DBUILD_JAVASCRIPT:BOOL=OFF" "-DBUILD_NODEJS:BOOL=OFF" @@ -111,31 +77,6 @@ stdenv.mkDerivation rec { "-DOPENSSL_USE_STATIC_LIBS=ON" ]; - disabledTests = [ - "PythonTestSSLSocket" - "PythonThriftTNonblockingServer" - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - # Tests that hang up in the Darwin sandbox - "SecurityTest" - "SecurityFromBufferTest" - "python_test" - - # fails on hydra, passes locally - "concurrency_test" - - # Tests that fail in the Darwin sandbox when trying to use network - "UnitTests" - "TInterruptTest" - "TServerIntegrationTest" - "processor" - "TNonblockingServerTest" - "TNonblockingSSLServerTest" - "StressTest" - "StressTestConcurrent" - "StressTestNonBlocking" - ]; - doCheck = !static; checkPhase = '' From 6745d72d7fb53623ceccbcd7703e8e2bb4d68229 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Sun, 14 Sep 2025 20:47:26 +0200 Subject: [PATCH 2/5] thrift: 0.21.0 -> 0.22.0 Diff: https://github.com/apache/thrift/compare/v0.21.0...v0.21.0 --- pkgs/by-name/th/thrift/package.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/th/thrift/package.nix b/pkgs/by-name/th/thrift/package.nix index 785acd45774c..829cf5c8a2eb 100644 --- a/pkgs/by-name/th/thrift/package.nix +++ b/pkgs/by-name/th/thrift/package.nix @@ -1,7 +1,6 @@ { lib, stdenv, - fetchpatch, fetchFromGitHub, boost, zlib, @@ -15,15 +14,15 @@ static ? stdenv.hostPlatform.isStatic, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "thrift"; - version = "0.21.0"; + version = "0.22.0"; src = fetchFromGitHub { owner = "apache"; repo = "thrift"; - tag = "v0.21.0"; - hash = "sha256-OF/pFG8OXROsyYGf6jgfVTYTrTc8UB5QJh4gbostFfU="; + tag = "v${finalAttrs.version}"; + hash = "sha256-gGAO+D0A/hEoHMm6OvRBc1Mks9y52kfd0q/Sg96pdW4="; }; # Workaround to make the Python wrapper not drop this package: @@ -97,4 +96,4 @@ stdenv.mkDerivation rec { platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ bjornfor ]; }; -} +}) From 920d6e9acf4580c0181059071c9ba947c6abd36f Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 23 Sep 2025 01:27:48 +0200 Subject: [PATCH 3/5] thrift: fix CMake flags logs did contain ``` thrift> -- Build shared libraries: OFF ``` And upstream README in lib/cpp says: ``` THRIFT-4732: The CMake build options WITH_SHARED_LIBS and WITH_STATIC_LIBS are deprecated. The project no longer performs a side-by-side static and shared build; you tell CMake through BUILD_SHARED_LIBS whether to make shared or static libraries now. This is CMake standard behavior. ``` --- pkgs/by-name/th/thrift/package.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/th/thrift/package.nix b/pkgs/by-name/th/thrift/package.nix index 829cf5c8a2eb..eed8dc883783 100644 --- a/pkgs/by-name/th/thrift/package.nix +++ b/pkgs/by-name/th/thrift/package.nix @@ -64,16 +64,14 @@ stdenv.mkDerivation (finalAttrs: { ''; cmakeFlags = [ - "-DBUILD_JAVASCRIPT:BOOL=OFF" - "-DBUILD_NODEJS:BOOL=OFF" + (lib.cmakeBool "BUILD_JAVASCRIPT" false) + (lib.cmakeBool "BUILD_NODEJS" false) + (lib.cmakeBool "BUILD_SHARED_LIBS" (!static)) + (lib.cmakeBool "OPENSSL_USE_STATIC_LIBS" static) # FIXME: Fails to link in static mode with undefined reference to # `boost::unit_test::unit_test_main(bool (*)(), int, char**)' - "-DBUILD_TESTING:BOOL=${if static then "OFF" else "ON"}" - ] - ++ lib.optionals static [ - "-DWITH_STATIC_LIB:BOOL=ON" - "-DOPENSSL_USE_STATIC_LIBS=ON" + (lib.cmakeBool "BUILD_TESTING" (!static)) ]; doCheck = !static; From 791d9f749f248aa614033a1cf8701ecaecde19e1 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 23 Sep 2025 02:45:50 +0200 Subject: [PATCH 4/5] thrift: ctestCheckHook --- pkgs/by-name/th/thrift/package.nix | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/th/thrift/package.nix b/pkgs/by-name/th/thrift/package.nix index eed8dc883783..a0812de681c6 100644 --- a/pkgs/by-name/th/thrift/package.nix +++ b/pkgs/by-name/th/thrift/package.nix @@ -11,6 +11,7 @@ pkg-config, bison, flex, + ctestCheckHook, static ? stdenv.hostPlatform.isStatic, }: @@ -59,6 +60,8 @@ stdenv.mkDerivation (finalAttrs: { zlib ]; + nativeCheckInputs = [ ctestCheckHook ]; + preConfigure = '' export PY_PREFIX=$out ''; @@ -74,16 +77,12 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "BUILD_TESTING" (!static)) ]; + disabledTests = [ + "UnitTests" # getaddrinfo() -> -3; Temporary failure in name resolution + "python_test" # many failures about python 2 or network things + ]; doCheck = !static; - checkPhase = '' - runHook preCheck - - ${lib.optionalString stdenv.hostPlatform.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/lib ctest -E "($(echo "$disabledTests" | tr " " "|"))" - - runHook postCheck - ''; - enableParallelChecking = false; meta = with lib; { From c9041aef41ffabd11b3d7d0773da1a9aef0bafaa Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 23 Sep 2025 02:50:35 +0200 Subject: [PATCH 5/5] thrift: get darwin disabledTests back --- pkgs/by-name/th/thrift/package.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkgs/by-name/th/thrift/package.nix b/pkgs/by-name/th/thrift/package.nix index a0812de681c6..ac0a73247061 100644 --- a/pkgs/by-name/th/thrift/package.nix +++ b/pkgs/by-name/th/thrift/package.nix @@ -80,7 +80,28 @@ stdenv.mkDerivation (finalAttrs: { disabledTests = [ "UnitTests" # getaddrinfo() -> -3; Temporary failure in name resolution "python_test" # many failures about python 2 or network things + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Tests that hang up in the Darwin sandbox + "SecurityTest" + "SecurityFromBufferTest" + "python_test" + + # fails on hydra, passes locally + "concurrency_test" + + # Tests that fail in the Darwin sandbox when trying to use network + "UnitTests" + "TInterruptTest" + "TServerIntegrationTest" + "processor" + "TNonblockingServerTest" + "TNonblockingSSLServerTest" + "StressTest" + "StressTestConcurrent" + "StressTestNonBlocking" ]; + doCheck = !static; enableParallelChecking = false;