[bug#75317,4/6] gnu: gnucash: Do not wrap finance-quote-wrapper.

Message ID b37c4c05d8df86ae94098e033249cd3ef10038a1.1735912713.git.~@wolfsden.cz
State New
Headers
Series gnu: gnucash: Fix getting quotes |

Commit Message

Tomas Volf Jan. 3, 2025, 2:24 p.m. UTC
  The file needs no special wrapping.  Even before, it was wrapped just by
accident (via the glib-or-gtk-wrap phase).  Wrapping changes it from perl
script to shell script and gnucash cannot deal with that.  So stop wrapping
it.

* gnu/packages/gnucash.scm (gnucash)[arguments]<#:phases>: Add 'unwrap-some.
Wrap gnucash-cli in 'wrap-programs.

Change-Id: I60e7ac5cf40fb00f9620b9ee9d725770009721d2
---
 gnu/packages/gnucash.scm | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
  

Patch

diff --git a/gnu/packages/gnucash.scm b/gnu/packages/gnucash.scm
index 12a168d6fd..3f4967b2ef 100644
--- a/gnu/packages/gnucash.scm
+++ b/gnu/packages/gnucash.scm
@@ -151,8 +151,10 @@  (define-public gnucash
                                 'inputs
                                 (map (lambda (l)
                                        (assoc l (package-inputs this-package)))
-                                     '("perl-finance-quote"))))))))
-               '("gnucash"))))
+                                     '("perl-json-parse"
+                                       "perl-finance-quote"))))))))
+               '("gnucash"
+                 "gnucash-cli"))))
           (add-after 'install 'glib-or-gtk-compile-schemas
             (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
           (add-after 'install 'glib-or-gtk-wrap
@@ -161,7 +163,18 @@  (define-public gnucash
             (lambda _
               ;; We are not updating Finance::Quote from CPAN.  There is no
               ;; reason to install this binary.
-              (delete-file (string-append #$output "/bin/gnc-fq-update")))))))
+              (delete-file (string-append #$output "/bin/gnc-fq-update"))))
+          (add-after 'glib-or-gtk-wrap 'unwrap-some
+            (lambda _
+              (for-each
+               (lambda (prog)
+                 (delete-file (string-append #$output "/bin/" prog))
+                 (rename-file (string-append #$output "/bin/." prog "-real")
+                              (string-append #$output "/bin/" prog)))
+               ;; Sadly glib-or-gtk-wrap does not allow excluding individual
+               ;; files.  Being wrapped breaks the finance-quote-wrapper (it
+               ;; is expected to be a perl script, not a shell one).
+               '("finance-quote-wrapper")))))))
     (native-inputs
      (list gmp
            `(,glib "bin")               ;glib-compile-schemas, etc.