about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2023-12-18 02:37:22 +0100
committerOPNA2608 <christoph.neidahl@gmail.com>2023-12-18 02:37:22 +0100
commit07130e98563c9467969815060b7f7891a4922ff3 (patch)
tree9309455a8f0fdb11d157fda1a1759949702ccaa6 /pkgs/by-name
parent5079ef293082fd890601c05e602e1420a7555032 (diff)
persistent-cache-cpp: Fetch upstream-submitted patches
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/pe/persistent-cache-cpp/0001-persistent-cache-cpp-Lenient-exception-test-matching.patch41
-rw-r--r--pkgs/by-name/pe/persistent-cache-cpp/package.nix42
2 files changed, 35 insertions, 48 deletions
diff --git a/pkgs/by-name/pe/persistent-cache-cpp/0001-persistent-cache-cpp-Lenient-exception-test-matching.patch b/pkgs/by-name/pe/persistent-cache-cpp/0001-persistent-cache-cpp-Lenient-exception-test-matching.patch
deleted file mode 100644
index 40d1cb6bf49ef..0000000000000
--- a/pkgs/by-name/pe/persistent-cache-cpp/0001-persistent-cache-cpp-Lenient-exception-test-matching.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 74265493be3a4826199329d4e6ff8fc49a33850f Mon Sep 17 00:00:00 2001
-From: Puna2608 <opna2608@protonmail.com>
-Date: Fri, 6 Oct 2023 21:06:13 +0200
-Subject: [PATCH] persistent-cache-cpp: Lenient exception test matching
-
-PersistentStringCacheImpl::exceptions attempts to very precisely match a returned std::system_error exception text to an expectation.
-On LLVM's libcxx, the message returned from it doesn't match the expectation.
-
-This patch changes the matching to only care about the part that doesn't depend on such an implementation detail.
----
- .../persistent_string_cache_impl_test.cpp                  | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp b/tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp
-index f3eee59..fedd466 100644
---- a/tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp
-+++ b/tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp
-@@ -24,6 +24,7 @@
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
- #include <gtest/gtest.h>
-+#include <gmock/gmock.h>
- #pragma GCC diagnostic pop
- 
- #include <iostream>
-@@ -1295,9 +1296,9 @@ TEST(PersistentStringCacheImpl, exceptions)
-             }
-             catch (system_error const& e)
-             {
--                EXPECT_EQ("PersistentStringCache: check_version(): bad version: \"nan\" (cache_path: " + TEST_DB +
--                          "): Unknown error 666",
--                          e.what());
-+                EXPECT_THAT(
-+                    e.what(),
-+                    ::testing::StartsWith("PersistentStringCache: check_version(): bad version: \"nan\" (cache_path: " + TEST_DB + "): "));
-             }
-         }
- 
--- 
-2.40.1
-
diff --git a/pkgs/by-name/pe/persistent-cache-cpp/package.nix b/pkgs/by-name/pe/persistent-cache-cpp/package.nix
index 8f21ab46c6cb1..c7d212a477afe 100644
--- a/pkgs/by-name/pe/persistent-cache-cpp/package.nix
+++ b/pkgs/by-name/pe/persistent-cache-cpp/package.nix
@@ -1,6 +1,7 @@
 { stdenv
 , lib
 , fetchFromGitLab
+, fetchpatch
 , gitUpdater
 , testers
 , boost
@@ -31,10 +32,38 @@ stdenv.mkDerivation (finalAttrs: {
   ];
 
   patches = [
+    # Version in CMakeLists.txt didn't get bumped, emits wrong version in pkg-config
+    # Remove when https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/merge_requests/13 merged & in release
+    (fetchpatch {
+      name = "0001-persistent-cache-cpp-CMakeLists-txt-Update-version.patch";
+      url = "https://gitlab.com/OPNA2608/persistent-cache-cpp/-/commit/20d5d3f61563c62bcbe85e71ddc4fe16d7c995d5.patch";
+      hash = "sha256-BKovtT9OvV+xEwBO8AZTxAzL9kqyDB9ip32t2Xx4eIk=";
+    })
+
     # PersistentStringCacheImpl.exceptions test fails on LLVM's libcxx, it depends on std::system_error producing a very specific exception text
     # Expects "Unknown error 666", gets "unspecified generic_category error"
-    # https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/blob/1.0.5/tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp?ref_type=tags#L1298
-    ./0001-persistent-cache-cpp-Lenient-exception-test-matching.patch
+    # Remove when https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/merge_requests/14 merged & in release
+    (fetchpatch {
+      name = "0002-persistent-cache-cpp-persistent_string_cache_impl_test-libcxx-fix.patch";
+      url = "https://gitlab.com/OPNA2608/persistent-cache-cpp/-/commit/a696dbd3093b8333f9ee1f0cad846b2256c729c5.patch";
+      hash = "sha256-SJxdXeM7W+WKEmiLTwnQYAM7YmPayEk6vPb46y4thv4=";
+    })
+
+    # Enable usage of BUILD_TESTING to opting out of tests
+    # Remove when https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/merge_requests/15 merged & in release
+    (fetchpatch {
+      name = "0003-persistent-cache-cpp-Enable-opting-out-of-tests.patch";
+      url = "https://gitlab.com/OPNA2608/persistent-cache-cpp/-/commit/1fb06d28c16325e90046e93662c0f5fd16c29b4a.patch";
+      hash = "sha256-2/6EYBh71S4dzqWEde+3dLOGp015fN6IifAj1bI1XAI=";
+    })
+
+    # Enable linking based on stdenv (static or dynamic)
+    # Remove when https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/merge_requests/16 merged & in release
+    (fetchpatch {
+      name = "0004-persistent-cache-cpp-Un-hardcode-static-linking.patch";
+      url = "https://gitlab.com/OPNA2608/persistent-cache-cpp/-/commit/45cd84fe76e3a0e1da41a662df695009a6f4f07e.patch";
+      hash = "sha256-1UjdhzrjnIUO1ySaZTm0vkdNgok0RNlGtNOWUoAUlzU=";
+    })
   ];
 
   postPatch = ''
@@ -45,11 +74,9 @@ stdenv.mkDerivation (finalAttrs: {
     # Runs in parallel to other tests, limit to 1 thread
     substituteInPlace tests/headers/compile_headers.py \
       --replace 'multiprocessing.cpu_count()' '1'
-  '' + (if finalAttrs.finalPackage.doCheck then ''
+  '' + lib.optionalString finalAttrs.finalPackage.doCheck ''
     patchShebangs tests/{headers,whitespace}/*.py
-  '' else ''
-    sed -i -e '/add_subdirectory(tests)/d' CMakeLists.txt
-  '');
+  '';
 
   nativeBuildInputs = [
     cmake
@@ -76,7 +103,8 @@ stdenv.mkDerivation (finalAttrs: {
 
   cmakeFlags = [
     # error: 'old_version' may be used uninitialized
-    "-DWerror=OFF"
+    (lib.cmakeBool "Werror" false)
+    (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
   ];
 
   doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;