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
This commit is contained in:
Yongun Seong
2023-09-25 15:29:41 +09:00
committed by Anderson Torres
parent 5dea4f1dbf
commit f4599feae4
3 changed files with 22 additions and 45 deletions

View File

@@ -1,8 +1,6 @@
diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp --- a/libgnucash/app-utils/gnc-quotes.cpp 2023-09-23 07:04:21.000000000 +0900
index 3003fca71f..2f2b1398e1 100644 +++ b/libgnucash/app-utils/gnc-quotes.cpp 2023-09-25 11:58:46.482696433 +0900
--- a/libgnucash/app-utils/gnc-quotes.cpp @@ -125,7 +125,6 @@
+++ b/libgnucash/app-utils/gnc-quotes.cpp
@@ -122,7 +122,6 @@ private:
class GncFQQuoteSource final : public GncQuoteSource class GncFQQuoteSource final : public GncQuoteSource
{ {
@@ -10,7 +8,7 @@ index 3003fca71f..2f2b1398e1 100644
std::string c_fq_wrapper; std::string c_fq_wrapper;
std::string m_version; std::string m_version;
StrVec m_sources; 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{}; static const std::string empty_string{};
GncFQQuoteSource::GncFQQuoteSource() : GncFQQuoteSource::GncFQQuoteSource() :
@@ -25,7 +23,7 @@ index 3003fca71f..2f2b1398e1 100644
auto [rv, sources, errors] = run_cmd(args, empty_string); auto [rv, sources, errors] = run_cmd(args, empty_string);
if (rv) if (rv)
{ {
@@ -197,7 +195,7 @@ m_version{}, m_sources{}, m_api_key{} @@ -200,7 +198,7 @@
QuoteResult QuoteResult
GncFQQuoteSource::get_quotes(const std::string& json_str) const GncFQQuoteSource::get_quotes(const std::string& json_str) const
{ {
@@ -34,7 +32,7 @@ index 3003fca71f..2f2b1398e1 100644
return run_cmd(args, json_str); 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); auto input_buf = bp::buffer (json_string);
bp::child process; bp::child process;
if (m_api_key.empty()) if (m_api_key.empty())
@@ -43,6 +41,8 @@ index 3003fca71f..2f2b1398e1 100644
bp::std_out > out_buf, bp::std_out > out_buf,
bp::std_err > err_buf, bp::std_err > err_buf,
bp::std_in < input_buf, bp::std_in < input_buf,
@@ -227,7 +225,7 @@
#endif
svc); svc);
else else
- process = bp::child(c_cmd, args, - process = bp::child(c_cmd, args,

View File

@@ -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{

View File

@@ -1,6 +1,7 @@
{ lib { lib
, stdenv , stdenv
, fetchurl , fetchurl
, fetchpatch
, aqbanking , aqbanking
, boost , boost
, cmake , cmake
@@ -26,12 +27,13 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "gnucash"; pname = "gnucash";
version = "5.3"; version = "5.4";
# raw source code doesn't work out of box; fetchFromGitHub not usable # raw source code doesn't work out of box; fetchFromGitHub not usable
src = fetchurl { src = fetchurl {
url = "https://github.com/Gnucash/gnucash/releases/download/${version}/${pname}-${version}.tar.bz2"; # Upstream uploaded a -1 tarball on the same release, remove on next release
hash = "sha256-FFjLCMWF6unXJL7G8oErzAO76D7SlKRqeJeqqwGm8Vo="; url = "https://github.com/Gnucash/gnucash/releases/download/${version}/${pname}-${version}-1.tar.bz2";
hash = "sha256-d0EWXW1lLqe0oehJjPQ5pWuBpcyLZTKRpZBU8jYqv8w=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@@ -74,8 +76,12 @@ stdenv.mkDerivation rec {
./0003-remove-valgrind.patch ./0003-remove-valgrind.patch
# this patch makes gnucash exec the Finance::Quote wrapper directly # this patch makes gnucash exec the Finance::Quote wrapper directly
./0004-exec-fq-wrapper.patch ./0004-exec-fq-wrapper.patch
# this patch removes the online_wiggle GncQuotes test # this patch fixes a test that fails due to a type error, remove on next release
./0005-remove-gncquotes-online-wiggle.patch (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 # this needs to be an environment variable and not a cmake flag to suppress
@@ -95,7 +101,7 @@ stdenv.mkDerivation rec {
gappsWrapperArgs+=( gappsWrapperArgs+=(
# db drivers location # db drivers location
--set GNC_DBD_DIR ${libdbiDrivers}/lib/dbd --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}"} --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 # gnc-fq-* are cli utils written in Perl hence the extra wrapping
postFixup = '' postFixup = ''
wrapProgram $out/bin/gnucash "''${gappsWrapperArgs[@]}" wrapProgram $out/bin/gnucash "''${gappsWrapperArgs[@]}"
wrapProgram $out/bin/gnucash-cli "''${gappsWrapperArgs[@]}"
wrapProgram $out/bin/finance-quote-wrapper \ wrapProgram $out/bin/finance-quote-wrapper \
--prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ JSONParse FinanceQuote ]}" --prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ JSONParse FinanceQuote ]}"
@@ -139,6 +146,7 @@ stdenv.mkDerivation rec {
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = with maintainers; [ domenkozar AndersonTorres rski nevivurn ]; maintainers = with maintainers; [ domenkozar AndersonTorres rski nevivurn ];
platforms = platforms.unix; platforms = platforms.unix;
mainProgram = "gnucash";
}; };
} }
# TODO: investigate Darwin support # TODO: investigate Darwin support