From dd3c008537970513873aa7bfcf05de8bf05ed5e1 Mon Sep 17 00:00:00 2001 From: Yongun Seong Date: Thu, 27 Apr 2023 22:51:56 +0900 Subject: [PATCH] gnucash: 4.12 -> 5.1 - https://github.com/Gnucash/gnucash/releases/tag/5.0 - https://github.com/Gnucash/gnucash/releases/tag/5.1 Co-authored-by: Anderson Torres --- .../gnucash/0002-disable-gnc-fq-update.patch | 10 +- .../office/gnucash/0003-remove-valgrind.patch | 9 +- .../office/gnucash/0004-exec-fq-helpers.patch | 23 ---- .../office/gnucash/0004-exec-fq-wrapper.patch | 46 +++++++ .../0005-remove-gncquotes-online-wiggle.patch | 31 +++++ pkgs/applications/office/gnucash/default.nix | 127 ++---------------- 6 files changed, 98 insertions(+), 148 deletions(-) delete mode 100644 pkgs/applications/office/gnucash/0004-exec-fq-helpers.patch create mode 100644 pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch create mode 100644 pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch diff --git a/pkgs/applications/office/gnucash/0002-disable-gnc-fq-update.patch b/pkgs/applications/office/gnucash/0002-disable-gnc-fq-update.patch index f379cd5e259d..25170b87129f 100644 --- a/pkgs/applications/office/gnucash/0002-disable-gnc-fq-update.patch +++ b/pkgs/applications/office/gnucash/0002-disable-gnc-fq-update.patch @@ -1,12 +1,12 @@ diff --git a/libgnucash/quotes/CMakeLists.txt b/libgnucash/quotes/CMakeLists.txt -index b33569d39..fdbfa10a9 100644 +index 7e42016629..7211663408 100644 --- a/libgnucash/quotes/CMakeLists.txt +++ b/libgnucash/quotes/CMakeLists.txt @@ -1,6 +1,6 @@ set(_BIN_FILES "") --foreach(file gnc-fq-check.in gnc-fq-helper.in gnc-fq-update.in gnc-fq-dump.in) -+foreach(file gnc-fq-check.in gnc-fq-helper.in gnc-fq-dump.in) +-foreach(file gnc-fq-update.in finance-quote-wrapper.in) ++foreach(file finance-quote-wrapper.in) string(REPLACE ".in" "" _OUTPUT_FILE_NAME ${file}) set(_ABS_OUTPUT_FILE ${BINDIR_BUILD}/${_OUTPUT_FILE_NAME}) configure_file( ${file} ${_ABS_OUTPUT_FILE} @ONLY) @@ -14,5 +14,5 @@ index b33569d39..fdbfa10a9 100644 install(FILES ${_MAN_FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) install(PROGRAMS ${_BIN_FILES} DESTINATION ${CMAKE_INSTALL_BINDIR}) --set_dist_list(quotes_DIST CMakeLists.txt gnc-fq-check.in gnc-fq-dump.in gnc-fq-helper.in gnc-fq-update.in Quote_example.pl README) -+set_dist_list(quotes_DIST CMakeLists.txt gnc-fq-check.in gnc-fq-dump.in gnc-fq-helper.in Quote_example.pl README) +-set_dist_list(quotes_DIST CMakeLists.txt gnc-fq-update.in finance-quote-wrapper.in README) ++set_dist_list(quotes_DIST CMakeLists.txt finance-quote-wrapper.in README) diff --git a/pkgs/applications/office/gnucash/0003-remove-valgrind.patch b/pkgs/applications/office/gnucash/0003-remove-valgrind.patch index 8bbb17e353fa..329b87985383 100644 --- a/pkgs/applications/office/gnucash/0003-remove-valgrind.patch +++ b/pkgs/applications/office/gnucash/0003-remove-valgrind.patch @@ -1,8 +1,8 @@ diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt -index 8e6e339d1..3936a8cb6 100644 +index 95ff42cd8f..1c1944a811 100644 --- a/gnucash/CMakeLists.txt +++ b/gnucash/CMakeLists.txt -@@ -163,13 +163,6 @@ set(GNUCASH_BIN_INSTALL_NAME "gnucash") +@@ -169,13 +169,6 @@ set(GNUCASH_BIN_INSTALL_NAME "gnucash") set(VALGRIND_OUTDIR ${BINDIR_BUILD}) @@ -16,7 +16,7 @@ index 8e6e339d1..3936a8cb6 100644 ## Create the environment file file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/environment.in ENV_STRINGS_IN) -@@ -253,7 +246,6 @@ file(COPY ${ENV_FILE_OUT} +@@ -259,14 +252,13 @@ file(COPY ${ENV_FILE_OUT} FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) @@ -24,12 +24,11 @@ index 8e6e339d1..3936a8cb6 100644 install(FILES ${ENVIRONMENT_FILE_DIR}/environment DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/gnucash) -@@ -274,7 +266,7 @@ gnc_add_scheme_targets(price-quotes set_local_dist(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script gnucash.cpp gnucash-commands.cpp gnucash-cli.cpp gnucash-core-app.cpp - gnucash-locale-macos.mm gnucash-locale-windows.c gnucash.rc.in gnucash-valgrind.in + gnucash-locale-macos.mm gnucash-locale-windows.c gnucash.rc.in - gnucash-gresources.xml ${gresource_files} price-quotes.scm + ${gnucash_GRESOURCES} ${gnucash_noinst_HEADERS} ${gnucash_EXTRA_DIST}) diff --git a/pkgs/applications/office/gnucash/0004-exec-fq-helpers.patch b/pkgs/applications/office/gnucash/0004-exec-fq-helpers.patch deleted file mode 100644 index 289822365490..000000000000 --- a/pkgs/applications/office/gnucash/0004-exec-fq-helpers.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/gnucash/price-quotes.scm b/gnucash/price-quotes.scm -index 8e3ff255f..a6b805fa5 100644 ---- a/gnucash/price-quotes.scm -+++ b/gnucash/price-quotes.scm -@@ -44,7 +44,7 @@ - (define (start-program) - (set! program - (gnc-spawn-process-async -- (list "perl" "-w" gnc:*finance-quote-check*) #t))) -+ (list gnc:*finance-quote-check*) #t))) - - (define (get-sources) - (when program -@@ -119,7 +119,7 @@ - - (define (start-quoter) - (set! quoter -- (gnc-spawn-process-async (list "perl" "-w" gnc:*finance-quote-helper*) #t))) -+ (gnc-spawn-process-async (list gnc:*finance-quote-helper*) #t))) - - (define (get-quotes) - (when quoter - diff --git a/pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch b/pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch new file mode 100644 index 000000000000..e18337c74226 --- /dev/null +++ b/pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch @@ -0,0 +1,46 @@ +diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp +index 3003fca71f..e01cb10b50 100644 +--- a/libgnucash/app-utils/gnc-quotes.cpp ++++ b/libgnucash/app-utils/gnc-quotes.cpp +@@ -122,7 +122,6 @@ private: + + class GncFQQuoteSource final : public GncQuoteSource + { +- const bfs::path c_cmd; + std::string c_fq_wrapper; + std::string m_version; + StrVec m_sources; +@@ -145,7 +144,6 @@ static std::string parse_quotesource_error(const std::string& line); + static const std::string empty_string{}; + + GncFQQuoteSource::GncFQQuoteSource() : +-c_cmd{bp::search_path("perl")}, + m_version{}, m_sources{}, m_api_key{} + { + char *bindir = gnc_path_get_bindir(); +@@ -197,7 +195,7 @@ m_version{}, m_sources{}, m_api_key{} + QuoteResult + GncFQQuoteSource::get_quotes(const std::string& json_str) const + { +- StrVec args{"-w", c_fq_wrapper, "-f" }; ++ StrVec args{"-f" }; + return run_cmd(args, json_str); + } + +@@ -215,13 +213,13 @@ GncFQQuoteSource::run_cmd (const StrVec& args, const std::string& json_string) c + auto input_buf = bp::buffer (json_string); + bp::child process; + if (m_api_key.empty()) +- process = bp::child(c_cmd, args, ++ process = bp::child(c_fq_wrapper, args, + bp::std_out > out_buf, + bp::std_err > err_buf, + bp::std_in < input_buf, + svc); + else +- process = bp::child(c_cmd, args, ++ process = bp::child(c_fq_wrapper, args, + bp::std_out > out_buf, + bp::std_err > err_buf, + bp::std_in < input_buf, + diff --git a/pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch b/pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch new file mode 100644 index 000000000000..14b68555f367 --- /dev/null +++ b/pkgs/applications/office/gnucash/0005-remove-gncquotes-online-wiggle.patch @@ -0,0 +1,31 @@ +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 e22cd17cefa3..64a02e811167 100644 --- a/pkgs/applications/office/gnucash/default.nix +++ b/pkgs/applications/office/gnucash/default.nix @@ -1,6 +1,5 @@ { lib , stdenv -, fetchpatch2 , fetchurl , aqbanking , boost @@ -27,12 +26,12 @@ stdenv.mkDerivation rec { pname = "gnucash"; - version = "4.12"; + version = "5.1"; # 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-zIwFGla4u0M1ZtbiiQ31nz2JWjlcjPUkbBtygQLOEK4="; + hash = "sha256-imWB3ffHQJ22NlEGATUa9yTto2OrWbHV2o2YEDPyb3I="; }; nativeBuildInputs = [ @@ -61,7 +60,7 @@ stdenv.mkDerivation rec { webkitgtk ] ++ (with perlPackages; [ - DateManip + JSONParse FinanceQuote perl ]); @@ -73,124 +72,24 @@ stdenv.mkDerivation rec { ./0002-disable-gnc-fq-update.patch # this patch prevents the building of gnucash-valgrind ./0003-remove-valgrind.patch - # this patch makes gnucash exec the Finance::Quote helpers directly - ./0004-exec-fq-helpers.patch - # the following patches fix compilation with gcc 13 and glib > 2.76 - # "Build fails with gcc 13 and glib > 2.76" - (fetchpatch2 { - url = "https://github.com/Gnucash/gnucash/commit/184669f517744ac7be6e420e5e1f359384f676d5.patch"; - sha256 = "sha256-X5HCK//n+V5k/pEUNL6xwZY5NTeGnBt+7GhooqOXQ2I="; - }) - # "Build fails with gcc 13 and glib > 2.76, bis" - (fetchpatch2 { - url = "https://github.com/Gnucash/gnucash/commit/abcce5000ca72bf943ca8951867729942388848e.patch"; - sha256 = "sha256-WiMkozqMAYl5wrRhAQMNVDY77aRBa3E5/a0gvYyc9Zk="; - }) - # "Build fails with gcc 13 and glib > 2.76, ter" - (fetchpatch2 { - url = "https://github.com/Gnucash/gnucash/commit/89e63ef67235d231d242f018894295a6cb38cfc3.patch"; - sha256 = "sha256-xCkY8RlZPVDaRLbVn+QT28s4qIUgtMgjmuB0axSrNpw="; - }) - # "Build fails with gcc 13" - # "Protect against passing an lseek failure rv to read()." - (fetchpatch2 { - url = "https://github.com/Gnucash/gnucash/commit/ce3447e6ea8b2f734b24a2502e865ebbbc21aaaa.patch"; - sha256 = "sha256-mfPs/5rkCamihE0z1SRoX0tV4FNPkKUGd1T6iaCwy7E="; - }) - # "Fix crashes in test-engine on Arch Linux." - # Also fixes the same crashes in nixpkgs. - (fetchpatch2 { - url = "https://github.com/Gnucash/gnucash/commit/1020bde89c77f70cee6cc8181ead96e8fade47aa.patch"; - sha256 = "sha256-JCWm3M8hdgAwjuhLbFRN4Vk3BQqpn0FUwHk6Kg5Qa7Q="; - }) + # 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 needs to be an environment variable and not a cmake flag to suppress # guile warning - GUILE_AUTO_COMPILE="0"; + env.GUILE_AUTO_COMPILE = "0"; env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ # Needed with GCC 12 but breaks on darwin (with clang) or older gcc "-Wno-error=use-after-free" ]); - # `make check` target does not define its prerequisites but expects them to - # have already been built. The list of targets below was built through trial - # and error based on failing tests. doCheck = true; - preCheck = '' - make \ - test-account-object \ - test-address \ - test-agedver \ - test-app-utils \ - test-aqb \ - test-autoclear \ - test-backend-dbi \ - test-business \ - test-column-types \ - test-commodities \ - test-customer \ - test-dom-converters1 \ - test-dynload \ - test-employee \ - test-engine \ - test-exp-parser \ - test-gnc-glib-utils \ - test-gnc-guid \ - test-gnc-int128 \ - test-gnc-numeric \ - test-gnc-path-util \ - test-gnc-rational \ - test-group-vs-book \ - test-guid \ - test-import-account-matcher \ - test-import-backend \ - test-import-map \ - test-import-parse \ - test-import-pending-matches \ - test-incompatdep \ - test-job \ - test-kvp-frames \ - test-kvp-value \ - test-link-module-tax-us \ - test-link-ofx \ - test-load-backend \ - test-load-c \ - test-load-engine \ - test-load-example-account \ - test-load-xml2 \ - test-lots \ - test-modsysver \ - test-numeric \ - test-object \ - test-print-parse-amount \ - test-qof \ - test-qofquerycore \ - test-qofsession \ - test-query \ - test-querynew \ - test-recurrence \ - test-resolve-file-path \ - test-scm-query \ - test-scm-query-string \ - test-split-register-copy-ops \ - test-split-vs-account \ - test-sqlbe \ - test-string-converters \ - test-sx \ - test-tokenizer \ - test-transaction-reversal \ - test-transaction-voiding \ - test-userdata-dir \ - test-userdata-dir-invalid-home \ - test-vendor \ - test-xml-account \ - test-xml-commodity \ - test-xml-pricedb \ - test-xml-transaction \ - test-xml2-is-file - ''; + enableParallelChecking = true; + checkTarget = "check"; preFixup = '' gappsWrapperArgs+=( @@ -210,10 +109,8 @@ stdenv.mkDerivation rec { postFixup = '' wrapProgram $out/bin/gnucash "''${gappsWrapperArgs[@]}" - for file in $out/bin/gnc-fq-check $out/bin/gnc-fq-dump $out/bin/gnc-fq-helper; do - wrapProgram $file \ - --prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ DateManip FinanceQuote ]}" - done + wrapProgram $out/bin/finance-quote-wrapper \ + --prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ JSONParse FinanceQuote ]}" ''; meta = with lib; {