Commit f4599fea authored by Yongun Seong's avatar Yongun Seong Committed by Anderson Torres
Browse files

gnucash: 5.3 -> 5.4

Also:
- Remove old, no longer relevant patches
- Update 0004-exec-fq-wrapper.patch so it applies cleanly on 5.4
- Patch flaky test
- Remove the word "gnome", it breaks r-ryantm
- Wrap gnucash-cli the same way as the main binary
- Set meta.mainProgram
parent 5dea4f1d
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
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,
+0 −31
Original line number Diff line number Diff line
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{
+14 −6
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchurl
, fetchpatch
, aqbanking
, boost
, cmake
@@ -26,12 +27,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}/${pname}-${version}-1.tar.bz2";
    hash = "sha256-d0EWXW1lLqe0oehJjPQ5pWuBpcyLZTKRpZBU8jYqv8w=";
  };

  nativeBuildInputs = [
@@ -74,8 +76,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
@@ -95,7 +101,7 @@ stdenv.mkDerivation rec {
    gappsWrapperArgs+=(
      # db drivers location
      --set GNC_DBD_DIR ${libdbiDrivers}/lib/dbd
      # gnome settings schemas location on Nix
      # gsettings schema location on Nix
      --set GSETTINGS_SCHEMA_DIR ${glib.makeSchemaPath "$out" "${pname}-${version}"}
    )
  '';
@@ -108,6 +114,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 +146,7 @@ stdenv.mkDerivation rec {
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ domenkozar AndersonTorres rski nevivurn ];
    platforms = platforms.unix;
    mainProgram = "gnucash";
  };
}
# TODO: investigate Darwin support