Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnucash: 4.12 -> 5.1 #229638

Merged
merged 1 commit into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
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)
@@ -26,4 +26,4 @@ add_custom_target(quotes-bin ALL DEPENDS ${_BIN_FILES})
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)
9 changes: 4 additions & 5 deletions pkgs/applications/office/gnucash/0003-remove-valgrind.patch
Original file line number Diff line number Diff line change
@@ -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})

Expand All @@ -16,20 +16,19 @@ 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
)

-install(FILES ${SCRIPT_LIST} ${VALGRIND_OUTDIR}/gnucash-valgrind DESTINATION ${CMAKE_INSTALL_BINDIR})
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})

23 changes: 0 additions & 23 deletions pkgs/applications/office/gnucash/0004-exec-fq-helpers.patch

This file was deleted.

46 changes: 46 additions & 0 deletions pkgs/applications/office/gnucash/0004-exec-fq-wrapper.patch
Original file line number Diff line number Diff line change
@@ -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,

Original file line number Diff line number Diff line change
@@ -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{

127 changes: 12 additions & 115 deletions pkgs/applications/office/gnucash/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ lib
, stdenv
, fetchpatch2
, fetchurl
, aqbanking
, boost
Expand All @@ -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 = [
Expand Down Expand Up @@ -61,7 +60,7 @@ stdenv.mkDerivation rec {
webkitgtk
]
++ (with perlPackages; [
DateManip
JSONParse
FinanceQuote
perl
]);
Expand All @@ -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+=(
Expand All @@ -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; {
Expand Down