summary refs log tree commit diff
path: root/pkgs/applications/office/gnucash
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/office/gnucash')
-rw-r--r--pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch16
-rw-r--r--pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch31
-rw-r--r--pkgs/applications/office/gnucash/default.nix40
3 files changed, 41 insertions, 46 deletions
diff --git a/pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch b/pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch
index e2b81538046..8b00b275e59 100644
--- a/pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch
+++ b/pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch
@@ -1,8 +1,6 @@
-diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp
-index 3003fca71f..2f2b1398e1 100644
---- a/libgnucash/app-utils/gnc-quotes.cpp
-+++ b/libgnucash/app-utils/gnc-quotes.cpp
-@@ -122,7 +122,6 @@ private:
+--- a/libgnucash/app-utils/gnc-quotes.cpp	2023-09-23 07:04:21.000000000 +0900
++++ b/libgnucash/app-utils/gnc-quotes.cpp	2023-09-25 11:58:46.482696433 +0900
+@@ -125,7 +125,6 @@
  
  class GncFQQuoteSource final : public GncQuoteSource
  {
@@ -10,7 +8,7 @@ index 3003fca71f..2f2b1398e1 100644
      std::string c_fq_wrapper;
      std::string m_version;
      StrVec m_sources;
-@@ -145,13 +144,12 @@ static std::string parse_quotesource_error(const std::string& line);
+@@ -148,13 +147,12 @@
  static const std::string empty_string{};
  
  GncFQQuoteSource::GncFQQuoteSource() :
@@ -25,7 +23,7 @@ index 3003fca71f..2f2b1398e1 100644
      auto [rv, sources, errors] = run_cmd(args, empty_string);
      if (rv)
      {
-@@ -197,7 +195,7 @@ m_version{}, m_sources{}, m_api_key{}
+@@ -200,7 +198,7 @@
  QuoteResult
  GncFQQuoteSource::get_quotes(const std::string& json_str) const
  {
@@ -34,7 +32,7 @@ index 3003fca71f..2f2b1398e1 100644
      return run_cmd(args, json_str);
  }
  
-@@ -215,13 +213,13 @@ GncFQQuoteSource::run_cmd (const StrVec& args, const std::string& json_string) c
+@@ -218,7 +216,7 @@
          auto input_buf = bp::buffer (json_string);
  	bp::child process;
  	if (m_api_key.empty())
@@ -43,6 +41,8 @@ index 3003fca71f..2f2b1398e1 100644
  				bp::std_out > out_buf,
  				bp::std_err > err_buf,
  				bp::std_in < input_buf,
+@@ -227,7 +225,7 @@
+ #endif
  				svc);
  	else
 -	    process = bp::child(c_cmd, args,
diff --git a/pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch b/pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch
deleted file mode 100644
index 14b68555f36..00000000000
--- a/pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git a/libgnucash/app-utils/test/gtest-gnc-quotes.cpp b/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
-index 8a5221d19d..d14e96cb66 100644
---- a/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
-+++ b/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
-@@ -153,25 +153,6 @@ TEST_F(GncQuotesTest, quotable_commodities)
-     EXPECT_EQ(4u, commodities.size());
- }
- 
--#ifdef HAVE_F_Q
--TEST_F(GncQuotesTest, online_wiggle)
--{
--    GncQuotes quotes;
--    quotes.fetch(m_book);
--    auto pricedb{gnc_pricedb_get_db(m_book)};
--    auto failures{quotes.failures()};
--    ASSERT_EQ(1u, failures.size());
--    EXPECT_EQ(GncQuoteError::QUOTE_FAILED, std::get<2>(failures[0]));
--//    EXPECT_EQ(GncQuoteError::QUOTE_FAILED, std::get<2>(failures[1]));
--    EXPECT_EQ(3u, gnc_pricedb_get_num_prices(pricedb));
--}
--#else
--TEST_F(GncQuotesTest, fq_failure)
--{
--    EXPECT_THROW(GncQuotes quotes;, GncQuoteException);
--}
--#endif
--
- TEST_F(GncQuotesTest, offline_wiggle)
- {
-     StrVec quote_vec{
-
diff --git a/pkgs/applications/office/gnucash/default.nix b/pkgs/applications/office/gnucash/default.nix
index ae843bcf0f1..7c378bc52a9 100644
--- a/pkgs/applications/office/gnucash/default.nix
+++ b/pkgs/applications/office/gnucash/default.nix
@@ -1,6 +1,8 @@
 { lib
 , stdenv
+, fetchFromGitHub
 , fetchurl
+, fetchpatch
 , aqbanking
 , boost
 , cmake
@@ -26,12 +28,13 @@
 
 stdenv.mkDerivation rec {
   pname = "gnucash";
-  version = "5.3";
+  version = "5.4";
 
   # raw source code doesn't work out of box; fetchFromGitHub not usable
   src = fetchurl {
-    url = "https://github.com/Gnucash/gnucash/releases/download/${version}/${pname}-${version}.tar.bz2";
-    hash = "sha256-FFjLCMWF6unXJL7G8oErzAO76D7SlKRqeJeqqwGm8Vo=";
+    # Upstream uploaded a -1 tarball on the same release, remove on next release
+    url = "https://github.com/Gnucash/gnucash/releases/download/${version}/gnucash-${version}-1.tar.bz2";
+    hash = "sha256-d0EWXW1lLqe0oehJjPQ5pWuBpcyLZTKRpZBU8jYqv8w=";
   };
 
   nativeBuildInputs = [
@@ -74,8 +77,12 @@ stdenv.mkDerivation rec {
     ./0003-remove-valgrind.patch
     # this patch makes gnucash exec the Finance::Quote wrapper directly
     ./0004-exec-fq-wrapper.patch
-    # this patch removes the online_wiggle GncQuotes test
-    ./0005-remove-gncquotes-online-wiggle.patch
+    # this patch fixes a test that fails due to a type error, remove on next release
+    (fetchpatch {
+      name = "0005-utest-gnc-pricedb-fix.patch";
+      url = "https://github.com/Gnucash/gnucash/commit/0bd556c581ac462ca41b3cb533323fc3587051e1.patch";
+      hash = "sha256-k0ANZuOkWrtU4q380oDu/hC9PeGmujF49XEFQ8eCLGM=";
+    })
   ];
 
   # this needs to be an environment variable and not a cmake flag to suppress
@@ -91,12 +98,29 @@ stdenv.mkDerivation rec {
   enableParallelChecking = true;
   checkTarget = "check";
 
+  passthru.docs = stdenv.mkDerivation {
+    pname = "gnucash-docs";
+    inherit version;
+
+    src = fetchFromGitHub {
+      owner = "Gnucash";
+      repo = "gnucash-docs";
+      rev = version;
+      hash = "sha256-aPxQEcpo8SPv8lPQbxMl1wg8ijH9Rz0oo4K5lp3C/bw=";
+    };
+
+    nativeBuildInputs = [ cmake ];
+    buildInputs = [ libxml2 libxslt ];
+  };
+
   preFixup = ''
     gappsWrapperArgs+=(
+      # documentation
+      --prefix XDG_DATA_DIRS : ${passthru.docs}/share
       # db drivers location
       --set GNC_DBD_DIR ${libdbiDrivers}/lib/dbd
-      # gnome settings schemas location on Nix
-      --set GSETTINGS_SCHEMA_DIR ${glib.makeSchemaPath "$out" "${pname}-${version}"}
+      # gsettings schema location on Nix
+      --set GSETTINGS_SCHEMA_DIR ${glib.makeSchemaPath "$out" "gnucash-${version}"}
     )
   '';
 
@@ -108,6 +132,7 @@ stdenv.mkDerivation rec {
   # gnc-fq-* are cli utils written in Perl hence the extra wrapping
   postFixup = ''
     wrapProgram $out/bin/gnucash "''${gappsWrapperArgs[@]}"
+    wrapProgram $out/bin/gnucash-cli "''${gappsWrapperArgs[@]}"
 
     wrapProgram $out/bin/finance-quote-wrapper \
       --prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ JSONParse FinanceQuote ]}"
@@ -139,6 +164,7 @@ stdenv.mkDerivation rec {
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [ domenkozar AndersonTorres rski nevivurn ];
     platforms = platforms.unix;
+    mainProgram = "gnucash";
   };
 }
 # TODO: investigate Darwin support