Subject: bug#54396: closed (Re: [PATCH v6] gnu: python-notmuch2: Fix build.)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 23 Mar 2022 20:16:01 +0000

Your bug report

#54396: [PATCH] [WIP] gnu: python-notmuch2: Fix build.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
54396: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54396
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [PATCH v6] gnu: python-notmuch2: Fix build.
From: Liliana Marie Prikler <[email-masked]>
To: Tanguy Le Carrour <[email-masked]>, [email-masked]
Date: Wed, 23 Mar 2022 21:15:43 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Tanguy,

Am Dienstag, dem 22.03.2022 um 17:11 +0100 schrieb Tanguy Le Carrour:
> Hi Liliana,
> 
> Sorry, but I didn't find time last week-end to migrate the package
> definition to the new style! :-(
> 
> But, just in case in would make sense to fix the build before I found
> some time to do my homework, here is the patch!
> 
> Cheers,
I fixed some minor thing in the copyright line, added my own patch to
use the new style, and pushed both.

Cheers

Subject: [PATCH] [WIP] gnu: python-notmuch2: Fix build.
From: Tanguy Le Carrour <[email-masked]>
To: [email-masked]
Cc: Tanguy Le Carrour <[email-masked]>
Date: Tue, 15 Mar 2022 10:38:14 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Guix,

I'm (still) trying to fix a build failure I (unsuccessfully) reported
here: <https://lists.gnu.org/archive/html/guix-devel/2022-02/msg00302.html>.

I've tried and produced a patch, but, somehow, I cannot make it work! :-(

```
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
```

I'm not sure those lines are required, but at this point I've just
copied/pasted code I found in an other package definition.

```
+               ;(invoke "./configure" (string-append "--prefix=" out)))))
+               (invoke "bash" "./configure" (string-append "--prefix=" out)))))
```

If I "just" invoke `./configure` I get an error code, but no error
message. I had to prepend `bash` to get the error message telling me
that `cc` and `gcc` were missing.

```
+  #:use-module (gnu packages commencement)
; […]
+    (native-inputs (list gcc-toolchain))
```

When I add `#:use-module (gnu packages commencement)` I get the following error
message I cannot decipher:

```
error: tcc: unbound variable
hint: Did you forget a `use-modules' form?

error: googletest: unbound variable
hint: Did you forget a `use-modules' form?

; […]

Throw to key `unbound-variable' with args `("resolve-interface" "no binding `~A' in module ~A" (python (gnu packages python)) #f)'.
Backtrace:
In guix/store.scm:
   658:37 19 (thunk)
   1320:8 18 (call-with-build-handler #<procedure 7f3d04dabb70 at g…> …)
In guix/scripts/build.scm:
    499:2 17 (_)
In srfi/srfi-1.scm:
   673:15 16 (append-map _ _ . _)
   586:17 15 (map1 ((argument . "python-notmuch2") (build-mode . 0) …))
In guix/scripts/build.scm:
   519:31 14 (_ _)
In gnu/packages.scm:
    478:2 13 (%find-package "python-notmuch2" "python-notmuch2" #f)
    363:6 12 (find-best-packages-by-name _ _)
   293:56 11 (_ "python-notmuch2" _)
In unknown file:
          10 (force #<promise #<procedure 7f3d04634060 at gnu/packag…>)
In gnu/packages.scm:
   240:33  9 (fold-packages #<procedure 7f3d03cb34a8 at gnu/package…> …)
In guix/discovery.scm:
   159:11  8 (all-modules _ #:warn _)
In srfi/srfi-1.scm:
   460:18  7 (fold #<procedure 7f3d072f41e0 at guix/discovery.scm:1…> …)
In guix/discovery.scm:
   149:19  6 (_ _ ())
    116:5  5 (scheme-modules _ _ #:warn _)
In srfi/srfi-1.scm:
   691:23  4 (filter-map #<procedure 7f3d072f7f00 at guix/discove…> . #)
In guix/discovery.scm:
   124:24  3 (_ . _)
In guix/ui.scm:
    325:2  2 (report-unbound-variable-error _ #:frame _)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" (unbound-variable "resolve-interface" "no binding `~A' in module ~A" (python (gnu packages python)) #f))'.
```

Any advice welcome!

Regards,

-- 
Tanguy

---
 gnu/packages/mail.scm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d253ca7011..e7cf07944d 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -28,7 +28,7 @@
 ;;; Copyright © 2018 Alex Vong <[email-masked]>
 ;;; Copyright © 2018 Gábor Boskovits <[email-masked]>
 ;;; Copyright © 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <[email-masked]>
-;;; Copyright © 2019, 2020, 2021 Tanguy Le Carrour <[email-masked]>
+;;; Copyright © 2019, 2020-2022 Tanguy Le Carrour <[email-masked]>
 ;;; Copyright © 2020 Vincent Legoll <[email-masked]>
 ;;; Copyright © 2020 Justus Winter <[email-masked]>
 ;;; Copyright © 2020 Eric Brown <[email-masked]>
@@ -75,6 +75,7 @@ (define-module (gnu packages mail)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages calendar)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages commencement)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
@@ -1486,14 +1487,24 @@ (define-public python-notmuch2
   (package
     (inherit python-notmuch)
     (name "python-notmuch2")
-    (propagated-inputs (list python-cffi))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         ;; configure generates `bindings/python-cffi/_notmuch_config.py`
+         ;; https://git.notmuchmail.org/git?p=notmuch;a=commit;h=7b5921877e748338359a25dae578771f768183af
+         (add-after 'unpack 'run-configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+               ;(invoke "./configure" (string-append "--prefix=" out)))))
+               (invoke "bash" "./configure" (string-append "--prefix=" out)))))
          ;; This python package lives in a subdirectory of the notmuch source
          ;; tree, so chdir into it before building.
-         (add-after 'unpack 'enter-python-dir
+         (add-after 'run-configure 'enter-python-dir
            (lambda _ (chdir "bindings/python-cffi"))))))
+    (native-inputs (list gcc-toolchain))
+    (propagated-inputs (list python-cffi))
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))
 
-- 
2.34.0