Gentoo Archives: gentoo-commits

From: "Aaron W. Swenson" <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-office/gnucash/files/, app-office/gnucash/
Date: Wed, 09 Jan 2019 13:07:02
Message-Id: 1547039171.935fed447ee5a63e63e6a82ab5889be407de30b4.titanofold@gentoo
1 commit: 935fed447ee5a63e63e6a82ab5889be407de30b4
2 Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 9 13:05:16 2019 +0000
4 Commit: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 9 13:06:11 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=935fed44
7
8 app-office/gnucash: Bump to 3.4
9
10 Manually insert test-stress-options.scm as it is missing from the
11 source tarball, which causes the test-stress-options unit test to fail.
12
13 Add patch to fix test-transaction unit test failure.
14
15 Package-Manager: Portage-2.3.51, Repoman-2.3.11
16 Signed-off-by: Aaron W. Swenson <titanofold <AT> gentoo.org>
17
18 app-office/gnucash/Manifest | 1 +
19 .../files/gnucash-3.4-test-stress-options.scm | 315 +++++++++++++++++++++
20 .../files/gnucash-3.4-test-transaction.patch | 25 ++
21 app-office/gnucash/gnucash-3.4.ebuild | 178 ++++++++++++
22 4 files changed, 519 insertions(+)
23
24 diff --git a/app-office/gnucash/Manifest b/app-office/gnucash/Manifest
25 index c2508be7720..6bd42515824 100644
26 --- a/app-office/gnucash/Manifest
27 +++ b/app-office/gnucash/Manifest
28 @@ -1,3 +1,4 @@
29 DIST gnucash-3.2.tar.bz2 13383942 BLAKE2B ce4beb9eab290bbc85c4b3bf68b205a8ebb274056bf10ef1721bce48ec18e4df4b488ce885dc767b4f1e951dabcdc2ba702cb5fe239f249ec50c8d2d1d12a434 SHA512 ef74cbf396096a71316e14500a5b4e57670f9e9c0c5d46f3afe051ccbae2e46a5f14edd8dd805dfb61276b934db286d48ae044160699df82689e2718ed2f7573
30 DIST gnucash-3.3.tar.bz2 13440713 BLAKE2B a308af90d8a8e50eb732d29c7eadac1fb75b63006da5bbaa9044039c43c1c17976c6b6fdb1706a08a527b75b1300df3a8ed469151370097b0308a173a170e41b SHA512 4bf0369ca9b3c91c98a0d916f0befc7e5675a246559a6a72dba6592b64f56f3cbd1885b0711e44e8d9cca290be742812763691ae2f639ea31ec534e52e17b3f9
31 +DIST gnucash-3.4.tar.bz2 13564432 BLAKE2B 478d8e2e4acbd0725ceaf997a1e62ba3875e9d4a003e8a3e69111a9d29118447fb2da8ef3e5dd5274d83a3adef1ee9f4a153cdfd17cabe69864b53bab8c7e813 SHA512 4cebef0ba70e59a82d3b2b7b0b138ddb22e8866dc761e156ff1f15920145d12923719effef21ad4c65ccd62fbd14a1529cf0bfcaab70c5b33d103761d08062e0
32 DIST gtest-1.8.0.tar.gz 1281617 BLAKE2B ac052b4d0eb0d8ded03a8c7dff05177818627b8a51f2dbc2c162b2ee2a5d1323539e7d0d02236d9ebb799995e018f0171c2fdaeb4de3bb339548265e50de79e6 SHA512 1dbece324473e53a83a60601b02c92c089f5d314761351974e097b2cf4d24af4296f9eb8653b6b03b1e363d9c5f793897acae1f0c7ac40149216035c4d395d9d
33
34 diff --git a/app-office/gnucash/files/gnucash-3.4-test-stress-options.scm b/app-office/gnucash/files/gnucash-3.4-test-stress-options.scm
35 new file mode 100644
36 index 00000000000..e85cd61a8ef
37 --- /dev/null
38 +++ b/app-office/gnucash/files/gnucash-3.4-test-stress-options.scm
39 @@ -0,0 +1,315 @@
40 +(use-modules (ice-9 textual-ports))
41 +(use-modules (ice-9 popen))
42 +(use-modules (gnucash utilities))
43 +(use-modules (gnucash gnc-module))
44 +(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
45 +(use-modules (gnucash engine test test-extras))
46 +(use-modules (gnucash report standard-reports))
47 +(use-modules (gnucash report business-reports))
48 +(use-modules (gnucash report view-column))
49 +(use-modules (gnucash report stylesheets))
50 +(use-modules (gnucash report taxinvoice))
51 +(use-modules (gnucash report report-system))
52 +(use-modules (gnucash report report-system test test-extras))
53 +(use-modules (srfi srfi-64))
54 +(use-modules (srfi srfi-98))
55 +(use-modules (gnucash engine test srfi64-extras))
56 +(use-modules (sxml simple))
57 +(use-modules (sxml xpath))
58 +
59 +;; NOTE
60 +;; ----
61 +;; SIMPLE stress tests by default
62 +;;
63 +;; PAIRWISE COMBINATORICS are enabled by setting environment variable COMBINATORICS
64 +;; to the fullpath for the compiled jenny from http://burtleburtle.net/bob/math/jenny.html
65 +;;
66 +;; e.g. COMBINATORICS=/home/user/jenny/jenny ninja check
67 +
68 +(define optionslist '())
69 +
70 +(define (generate-optionslist)
71 + (gnc:report-templates-for-each
72 + (lambda (report-id template)
73 + (let* ((options-generator (gnc:report-template-options-generator template))
74 + (name (gnc:report-template-name template))
75 + (options (options-generator)))
76 + (set! optionslist
77 + (cons (list (cons 'report-id report-id)
78 + (cons 'report-name (gnc:report-template-name template))
79 + (cons 'options (let ((report-options-tested '()))
80 + (gnc:options-for-each
81 + (lambda (option)
82 + (when (memq (gnc:option-type option)
83 + '(multichoice boolean))
84 + (set! report-options-tested
85 + (cons (vector
86 + (gnc:option-section option)
87 + (gnc:option-name option)
88 + (gnc:option-type option)
89 + (case (gnc:option-type option)
90 + ((multichoice) (map (lambda (d) (vector-ref d 0))
91 + (gnc:option-data option)))
92 + ((boolean) (list #t #f))))
93 + report-options-tested))))
94 + options)
95 + report-options-tested)))
96 + optionslist))))))
97 +
98 +;; Explicitly set locale to make the report output predictable
99 +(setlocale LC_ALL "C")
100 +
101 +(define (run-test)
102 + (test-runner-factory gnc:test-runner)
103 + (test-begin "stress options")
104 + (generate-optionslist)
105 + (tests)
106 + (test-end "stress options"))
107 +
108 +(define jennypath
109 + (get-environment-variable "COMBINATORICS"))
110 +
111 +(define jenny-exists?
112 + ;; this is a simple test for presence of jenny - will check
113 + ;; COMBINATORICS env exists, and running it produces exit-code of
114 + ;; zero, and tests the first few letters of its output.
115 + (and (string? jennypath)
116 + (zero? (system jennypath))
117 + (string=? (string-take (get-string-all (open-input-pipe jennypath)) 6)
118 + "jenny:")))
119 +
120 +(define (set-option! options section name value)
121 + (let ((option (gnc:lookup-option options section name)))
122 + (if option
123 + (gnc:option-set-value option value))))
124 +
125 +(define (mnemonic->commodity sym)
126 + (gnc-commodity-table-lookup
127 + (gnc-commodity-table-get-table (gnc-get-current-book))
128 + (gnc-commodity-get-namespace (gnc-default-report-currency))
129 + sym))
130 +
131 +(define structure
132 + (list "Root" (list (cons 'type ACCT-TYPE-ASSET))
133 + (list "Asset"
134 + (list "Bank")
135 + (list "GBP Bank" (list (cons 'commodity (mnemonic->commodity "GBP"))))
136 + (list "Wallet"))
137 + (list "Income" (list (cons 'type ACCT-TYPE-INCOME)))
138 + (list "Income-GBP" (list (cons 'type ACCT-TYPE-INCOME)
139 + (cons 'commodity (mnemonic->commodity "GBP"))))
140 + (list "Expenses" (list (cons 'type ACCT-TYPE-EXPENSE)))
141 + (list "Liabilities" (list (cons 'type ACCT-TYPE-LIABILITY)))
142 + (list "Equity" (list (cons 'type ACCT-TYPE-EQUITY)))
143 + ))
144 +
145 +(define (simple-stress-test report-name uuid report-options)
146 + (let ((options (gnc:make-report-options uuid)))
147 + (test-assert (format #f "basic test ~a" report-name)
148 + (gnc:options->render uuid options (string-append "stress-" report-name) "test"))
149 + (format #t "Testing SIMPLE combinations for:\n~a" report-name)
150 + (for-each
151 + (lambda (option)
152 + (format #t ",~a/~a"
153 + (vector-ref option 0)
154 + (vector-ref option 1)))
155 + report-options)
156 + (newline)
157 + (for-each
158 + (lambda (idx)
159 + (display report-name)
160 + (for-each
161 + (lambda (option)
162 + (let* ((section (vector-ref option 0))
163 + (name (vector-ref option 1))
164 + (value (list-ref (vector-ref option 3)
165 + (modulo idx (length (vector-ref option 3))))))
166 + (set-option! options section name value)
167 + (format #t ",~a"
168 + (cond
169 + ((boolean? value) (if value 't 'f))
170 + (else value)))))
171 + report-options)
172 + (catch #t
173 + (lambda ()
174 + (gnc:options->render uuid options "stress-test" "test")
175 + (display "[pass]\n"))
176 + (lambda (k . args)
177 + (format #t "[fail]... error: (~s . ~s) options-list are:\n~a"
178 + k args
179 + (gnc:html-render-options-changed options #t))
180 + (test-assert "logging test failure as above..."
181 + #f))))
182 + (iota
183 + (apply max
184 + (map (lambda (opt) (length (vector-ref opt 3)))
185 + report-options)))
186 + )))
187 +
188 +(define (combinatorial-stress-test report-name uuid report-options)
189 + (let* ((options (gnc:make-report-options uuid))
190 + (render #f))
191 + (test-assert (format #f "basic test ~a" report-name)
192 + (set! render
193 + (gnc:options->render
194 + uuid options (string-append "stress-" report-name) "test")))
195 + (if render
196 + (begin
197 + (format #t "Testing n-tuple combinatorics for:\n~a" report-name)
198 + (for-each
199 + (lambda (option)
200 + (format #t ",~a/~a"
201 + (vector-ref option 0)
202 + (vector-ref option 1)))
203 + report-options)
204 + (newline)
205 + ;; generate combinatorics
206 + (let* ((option-lengths (map (lambda (report-option)
207 + (length (vector-ref report-option 3)))
208 + report-options))
209 + (jennyargs (string-join (map number->string option-lengths) " "))
210 + (n-tuple (min
211 + ;; the following is the n-tuple
212 + 2
213 + (length report-options)))
214 + (cmdline (format #f "~a -n~a ~a"
215 + jennypath n-tuple jennyargs))
216 + (jennyout (get-string-all (open-input-pipe cmdline)))
217 + (test-cases (string-split jennyout #\newline)))
218 + (for-each
219 + (lambda (case)
220 + (unless (string-null? case)
221 + (let* ((choices-str (string-filter char-alphabetic? case))
222 + (choices-alpha (map char->integer (string->list choices-str)))
223 + (choices (map (lambda (n)
224 + (- n (if (> n 96) 97 39))) ; a-z -> 0-25, and A-Z -> 26-51
225 + choices-alpha)))
226 + (let loop ((option-idx (1- (length report-options)))
227 + (option-summary '()))
228 + (if (negative? option-idx)
229 + (catch #t
230 + (lambda ()
231 + (gnc:options->render uuid options "stress-test" "test")
232 + (format #t "[pass] ~a:~a \n"
233 + report-name
234 + (string-join option-summary ",")))
235 + (lambda (k . args)
236 + (format #t "[fail]... error (~s . ~s) options-list are:\n~a"
237 + k args
238 + (gnc:html-render-options-changed options #t))
239 + (test-assert "logging test failure as above..."
240 + #f)))
241 + (let* ((option (list-ref report-options option-idx))
242 + (section (vector-ref option 0))
243 + (name (vector-ref option 1))
244 + (value (list-ref (vector-ref option 3)
245 + (list-ref choices option-idx))))
246 + (set-option! options section name value)
247 + (loop (1- option-idx)
248 + (cons (format #f "~a"
249 + (cond
250 + ((boolean? value) (if value 't 'f))
251 + (else value)))
252 + option-summary))))))))
253 + test-cases)))
254 + (display "...aborted due to basic test failure"))))
255 +
256 +(define test
257 + ;; what strategy are we using here? simple stress test (ie tests as
258 + ;; many times as the maximum number of options) or combinatorial
259 + ;; tests (using jenny)
260 + (if jenny-exists?
261 + combinatorial-stress-test
262 + simple-stress-test))
263 +
264 +(define (create-test-data)
265 + (let* ((env (create-test-env))
266 + (account-alist (env-create-account-structure-alist env structure))
267 + (bank (cdr (assoc "Bank" account-alist)))
268 + (gbp-bank (cdr (assoc "GBP Bank" account-alist)))
269 + (wallet (cdr (assoc "Wallet" account-alist)))
270 + (income (cdr (assoc "Income" account-alist)))
271 + (gbp-income (cdr (assoc "Income-GBP" account-alist)))
272 + (expense (cdr (assoc "Expenses" account-alist)))
273 + (liability (cdr (assoc "Liabilities" account-alist)))
274 + (equity (cdr (assoc "Equity" account-alist))))
275 + ;; populate datafile with old transactions
276 + (env-transfer env 01 01 1970 bank expense 5 #:description "desc-1" #:num "trn1" #:memo "memo-3")
277 + (env-transfer env 31 12 1969 income bank 10 #:description "desc-2" #:num "trn2" #:void-reason "void" #:notes "notes3")
278 + (env-transfer env 31 12 1969 income bank 29 #:description "desc-3" #:num "trn3"
279 + #:reconcile (cons #\c (gnc-dmy2time64 01 03 1970)))
280 + (env-transfer env 01 02 1970 bank expense 15 #:description "desc-4" #:num "trn4" #:notes "notes2" #:memo "memo-1")
281 + (env-transfer env 10 01 1970 liability expense 10 #:description "desc-5" #:num "trn5" #:void-reason "any")
282 + (env-transfer env 10 01 1970 liability expense 11 #:description "desc-6" #:num "trn6" #:notes "notes1")
283 + (env-transfer env 10 02 1970 bank liability 8 #:description "desc-7" #:num "trn7" #:notes "notes1" #:memo "memo-2"
284 + #:reconcile (cons #\y (gnc-dmy2time64 01 03 1970)))
285 + (let ((txn (xaccMallocTransaction (gnc-get-current-book)))
286 + (split-1 (xaccMallocSplit (gnc-get-current-book)))
287 + (split-2 (xaccMallocSplit (gnc-get-current-book)))
288 + (split-3 (xaccMallocSplit (gnc-get-current-book))))
289 + (xaccTransBeginEdit txn)
290 + (xaccTransSetDescription txn "$100bank -> $80expenses + $20wallet")
291 + (xaccTransSetCurrency txn (xaccAccountGetCommodity bank))
292 + (xaccTransSetDate txn 14 02 1971)
293 + (xaccSplitSetParent split-1 txn)
294 + (xaccSplitSetParent split-2 txn)
295 + (xaccSplitSetParent split-3 txn)
296 + (xaccSplitSetAccount split-1 bank)
297 + (xaccSplitSetAccount split-2 expense)
298 + (xaccSplitSetAccount split-3 wallet)
299 + (xaccSplitSetValue split-1 -100)
300 + (xaccSplitSetValue split-2 80)
301 + (xaccSplitSetValue split-3 20)
302 + (xaccSplitSetAmount split-1 -100)
303 + (xaccSplitSetAmount split-2 80)
304 + (xaccSplitSetAmount split-3 20)
305 + (xaccTransSetNotes txn "multisplit")
306 + (xaccTransCommitEdit txn))
307 + (let ((closing-txn (env-transfer env 31 12 1977 expense equity 111 #:description "Closing")))
308 + (xaccTransSetIsClosingTxn closing-txn #t))
309 + (env-transfer-foreign env 15 01 2000 gbp-bank bank 10 14 #:description "GBP 10 to USD 14")
310 + (env-transfer-foreign env 15 02 2000 bank gbp-bank 9 6 #:description "USD 9 to GBP 6")
311 + (for-each (lambda (m)
312 + (env-transfer env 08 (1+ m) 1978 gbp-income gbp-bank 51 #:description "#51 income")
313 + (env-transfer env 03 (1+ m) 1978 income bank 103 #:description "$103 income")
314 + (env-transfer env 15 (1+ m) 1978 bank expense 22 #:description "$22 expense")
315 + (env-transfer env 09 (1+ m) 1978 income bank 109 #:description "$109 income"))
316 + (iota 12))
317 + (let ((mid (floor (/ (+ (gnc-accounting-period-fiscal-start)
318 + (gnc-accounting-period-fiscal-end)) 2))))
319 + (env-create-transaction env mid bank income 200))))
320 +
321 +(define (run-tests prefix)
322 + (for-each
323 + (lambda (option-set)
324 + (let ((report-name (assq-ref option-set 'report-name))
325 + (report-guid (assq-ref option-set 'report-id))
326 + (report-options (assq-ref option-set 'options)))
327 + (if (member report-name
328 + ;; these reports seem to cause problems when running...
329 + '(
330 + ;; eguile-based reports
331 + "Tax Invoice"
332 + "Receipt"
333 + "Australian Tax Invoice"
334 + "Balance Sheet (eguile)"
335 +
336 + ;; tax-schedule - locale-dependent?
337 + "Tax Schedule Report/TXF Export"
338 +
339 + ;; unusual reports
340 + "Welcome to GnuCash"
341 + "Hello, World"
342 + "Multicolumn View"
343 + "General Journal"
344 + ))
345 + (format #t "\nSkipping ~a ~a...\n" report-name prefix)
346 + (begin
347 + (format #t "\nTesting ~a ~a...\n" report-name prefix)
348 + (test report-name report-guid report-options)))))
349 + optionslist))
350 +
351 +(define (tests)
352 + (run-tests "with empty book")
353 + (create-test-data)
354 + (run-tests "on a populated book"))
355
356 diff --git a/app-office/gnucash/files/gnucash-3.4-test-transaction.patch b/app-office/gnucash/files/gnucash-3.4-test-transaction.patch
357 new file mode 100644
358 index 00000000000..bf7180e664f
359 --- /dev/null
360 +++ b/app-office/gnucash/files/gnucash-3.4-test-transaction.patch
361 @@ -0,0 +1,25 @@
362 +From 95bee405cf5568f5899287ba62058cf894361676 Mon Sep 17 00:00:00 2001
363 +From: Christopher Lam <christopher.lck@×××××.com>
364 +Date: Wed, 2 Jan 2019 00:00:56 +0800
365 +Subject: [PATCH] [test-transaction] fix a test which was hardcoded to 2018.
366 +
367 +This test was hard-coded to pass in 2018. Fix.
368 +---
369 + gnucash/report/standard-reports/test/test-transaction.scm | 4 ++--
370 + 1 file changed, 2 insertions(+), 2 deletions(-)
371 +
372 +diff --git a/gnucash/report/standard-reports/test/test-transaction.scm b/gnucash/report/standard-reports/test/test-transaction.scm
373 +index 755aba2983..2f428e24e9 100644
374 +--- a/gnucash/report/standard-reports/test/test-transaction.scm
375 ++++ b/gnucash/report/standard-reports/test/test-transaction.scm
376 +@@ -652,8 +652,8 @@
377 + (list "Grand Total" "$2,280.00" "$2,280.00")
378 + (get-row-col sxml -1 #f))
379 + (test-equal "dual amount column, first transaction correct"
380 +- (list "01/03/18" "$103 income" "Root.Asset.Bank" "$103.00" "$103.00")
381 +- (get-row-col sxml 1 #f)))
382 ++ (list "$103 income" "Root.Asset.Bank" "$103.00" "$103.00")
383 ++ (cdr (get-row-col sxml 1 #f))))
384 + )
385 +
386 + (test-end "display options")
387
388 diff --git a/app-office/gnucash/gnucash-3.4.ebuild b/app-office/gnucash/gnucash-3.4.ebuild
389 new file mode 100644
390 index 00000000000..970c9bf9bf2
391 --- /dev/null
392 +++ b/app-office/gnucash/gnucash-3.4.ebuild
393 @@ -0,0 +1,178 @@
394 +# Copyright 1999-2019 Gentoo Authors
395 +# Distributed under the terms of the GNU General Public License v2
396 +
397 +EAPI=6
398 +
399 +# google{test,mock} version
400 +GV="1.8.0"
401 +PYTHON_COMPAT=( python3_{4,5,6} )
402 +
403 +inherit cmake-utils gnome2-utils python-single-r1 xdg-utils
404 +
405 +DESCRIPTION="A personal finance manager"
406 +HOMEPAGE="http://www.gnucash.org/"
407 +SRC_URI="https://github.com/Gnucash/${PN}/releases/download/${PV}/${P}.tar.bz2
408 + https://github.com/google/googletest/archive/release-${GV}.tar.gz -> gtest-${GV}.tar.gz"
409 +
410 +SLOT="0"
411 +LICENSE="GPL-2"
412 +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
413 +
414 +IUSE="aqbanking chipcard debug doc examples gnome-keyring +gui mysql nls ofx
415 + postgres python quotes -register2 sqlite"
416 +
417 +REQUIRED_USE="
418 + chipcard? ( aqbanking )
419 + python? ( ${PYTHON_REQUIRED_USE} )"
420 +
421 +# libdbi version requirement for sqlite taken from bug #455134
422 +#
423 +# dev-libs/boost must always be built with nls enabled.
424 +# guile[deprecated] because of SCM_LIST*() use
425 +RDEPEND="
426 + >=dev-libs/glib-2.46.0:2
427 + >=dev-libs/libxml2-2.7.0:2
428 + >=sys-libs/zlib-1.1.4
429 + >=dev-scheme/guile-2.2.0:12=[deprecated,regex]
430 + dev-libs/boost:=[icu,nls]
431 + dev-libs/icu:=
432 + dev-libs/libxslt
433 + aqbanking? (
434 + >=net-libs/aqbanking-5[gtk,ofx?]
435 + sys-libs/gwenhywfar[gtk]
436 + chipcard? ( sys-libs/libchipcard )
437 + )
438 + gnome-keyring? ( >=app-crypt/libsecret-0.18 )
439 + gui? (
440 + gnome-base/dconf
441 + net-libs/webkit-gtk:4=
442 + >=x11-libs/gtk+-3.14.0:3
443 + )
444 + mysql? (
445 + dev-db/libdbi
446 + dev-db/libdbi-drivers[mysql]
447 + )
448 + ofx? ( >=dev-libs/libofx-0.9.1 )
449 + postgres? (
450 + dev-db/libdbi
451 + dev-db/libdbi-drivers[postgres]
452 + )
453 + python? ( ${PYTHON_DEPS} )
454 + quotes? (
455 + >=dev-perl/Finance-Quote-1.11
456 + dev-perl/Date-Manip
457 + dev-perl/HTML-TableExtract
458 + )
459 + sqlite? (
460 + >=dev-db/libdbi-0.9.0
461 + >=dev-db/libdbi-drivers-0.9.0[sqlite]
462 + )
463 +"
464 +
465 +DEPEND="${RDEPEND}
466 + ~dev-cpp/gtest-${GV}
467 + >=sys-devel/gettext-0.19.6
468 + dev-lang/perl
469 + dev-perl/XML-Parser
470 + sys-devel/libtool
471 + virtual/pkgconfig
472 +"
473 +
474 +PDEPEND="doc? (
475 + ~app-doc/gnucash-docs-${PV}
476 + gnome-extra/yelp
477 +)"
478 +
479 +PATCHES=( "${FILESDIR}"/${PN}-3.2-no-gui.patch
480 + # Fixed in 3.5
481 + "${FILESDIR}"/${PN}-3.4-test-transaction.patch )
482 +
483 +pkg_setup() {
484 + use python && python-single-r1_pkg_setup
485 + xdg_environment_reset
486 +}
487 +
488 +src_unpack() {
489 + default
490 + cp "${FILESDIR}"/gnucash-3.4-test-stress-options.scm \
491 + ${PN}-${PV}/${PN}/report/standard-reports/test/test-stress-options.scm \
492 + || die "Failed copying scm"
493 +}
494 +
495 +src_configure() {
496 + local sql_on_off="OFF"
497 + if use mysql || use postgres || use sqlite ; then
498 + sql_on_off="ON"
499 + fi
500 +
501 + local mycmakeargs=(
502 + -DGMOCK_ROOT="${WORKDIR}"/googletest-release-${GV}/googlemock
503 + -DGTEST_ROOT="${WORKDIR}"/googletest-release-${GV}/googletest
504 + # Disable fallback to guile-2.0
505 + -DCMAKE_DISABLE_FIND_PACKAGE_GUILE2=ON
506 + -DCOMPILE_GSCHEMAS=OFF
507 + -DDISABLE_NLS=$(usex !nls)
508 + -DENABLE_REGISTER2=$(usex register2)
509 + -DWITH_AQBANKING=$(usex aqbanking)
510 + -DWITH_OFX=$(usex ofx)
511 + -DWITH_PYTHON=$(usex python)
512 + -DWITH_SQL=${sql_on_off}
513 + -DWITH_GNUCASH=$(usex gui)
514 + )
515 +
516 + cmake-utils_src_configure
517 +}
518 +
519 +src_test() {
520 + if use python ; then
521 + cp common/test-core/unittest_support.py \
522 + "${BUILD_DIR}"/common/test-core/ || die
523 + fi
524 +
525 + cd "${BUILD_DIR}" || die
526 + XDG_DATA_HOME="${T}/$(whoami)" emake check
527 +}
528 +
529 +src_install() {
530 + cmake-utils_src_install
531 +
532 + rm "${ED%/}"/usr/share/doc/${PF}/README.dependencies || die
533 +
534 + if use examples ; then
535 + mv "${ED%/}"/usr/share/doc/gnucash \
536 + "${ED%/}"/usr/share/doc/${PF}/examples || die
537 + pushd "${ED%/}"/usr/share/doc/${PF}/examples/ > /dev/null || die
538 + rm AUTHORS DOCUMENTERS LICENSE NEWS projects.html ChangeLog* \
539 + *win32-bin.txt || die
540 + popd > /dev/null || die
541 + docompress -x /usr/share/doc/${PF}/examples/
542 + else
543 + rm -r "${ED%/}"/usr/share/doc/gnucash || die
544 + fi
545 +
546 + use aqbanking && dodoc doc/README.HBCI
547 + use ofx && dodoc doc/README.OFX
548 +}
549 +
550 +pkg_postinst() {
551 + if use gui ; then
552 + gnome2_icon_cache_update
553 + gnome2_schemas_update
554 + fi
555 + xdg_desktop_database_update
556 + xdg_mimeinfo_database_update
557 +
558 + ewarn "Backup all financial files or databases before using GnuCash >=2.7.0!"
559 + ewarn
560 + ewarn "GnuCash 2.7.0 introduced large changes in its file format and database"
561 + ewarn "schema that WILL prevent you from reverting back to GnuCash 2.6."
562 +}
563 +
564 +pkg_postrm() {
565 + if use gui ; then
566 + gnome2_icon_cache_update
567 + gnome2_schemas_update
568 + fi
569 + xdg_desktop_database_update
570 + xdg_mimeinfo_database_update
571 +}