From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id GK3xB07HMWLxqgAAgWs5BA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 16 Mar 2022 12:17:34 +0100
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id 6LVrBU7HMWJYggAA9RJhRA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 16 Mar 2022 12:17:34 +0100
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id AAC7829987
	for <larch@yhetil.org>; Wed, 16 Mar 2022 12:17:33 +0100 (CET)
Received: from localhost ([::1]:36598 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	id 1nURek-0000Cd-TL
	for larch@yhetil.org; Wed, 16 Mar 2022 07:17:32 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34428)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1nUReI-0008Md-UX
 for guix-patches@gnu.org; Wed, 16 Mar 2022 07:17:03 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:56488)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1nUReI-0005Jy-MP
 for guix-patches@gnu.org; Wed, 16 Mar 2022 07:17:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nUReI-0005jc-Ck
 for guix-patches@gnu.org; Wed, 16 Mar 2022 07:17:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
References: <20220315093814.25033-1-tanguy@bioneland.org>
In-Reply-To: <20220315093814.25033-1-tanguy@bioneland.org>
Resent-From: Tanguy Le Carrour <tanguy@bioneland.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: guix-patches@gnu.org
Resent-Date: Wed, 16 Mar 2022 11:17:02 +0000
Resent-Message-ID: <handler.54396.B54396.164742941522029@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 54396
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: liliana.prikler@ist.tugraz.at
Cc: Tanguy Le Carrour <tanguy@bioneland.org>, 54396@debbugs.gnu.org
Received: via spool by 54396-submit@debbugs.gnu.org id=B54396.164742941522029
 (code B ref 54396); Wed, 16 Mar 2022 11:17:02 +0000
Received: (at 54396) by debbugs.gnu.org; 16 Mar 2022 11:16:55 +0000
Received: from localhost ([127.0.0.1]:50385 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1nURe8-0005jB-E4
 for submit@debbugs.gnu.org; Wed, 16 Mar 2022 07:16:55 -0400
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:43529)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tanguy@bioneland.org>) id 1nURe7-0005is-5N
 for 54396@debbugs.gnu.org; Wed, 16 Mar 2022 07:16:51 -0400
Received: from rafflesia.easter-eggs.fr (176-159-32-89.abo.bbox.fr
 [176.159.32.89]) (Authenticated sender: tanguy@bioneland.org)
 by mail.gandi.net (Postfix) with ESMTPA id 1A5E6C0005;
 Wed, 16 Mar 2022 11:16:43 +0000 (UTC)
From: Tanguy Le Carrour <tanguy@bioneland.org>
Date: Wed, 16 Mar 2022 12:16:24 +0100
Message-Id: <20220316111624.26189-1-tanguy@bioneland.org>
X-Mailer: git-send-email 2.34.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: guix-patches@gnu.org
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-patches>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org
Sender: "Guix-patches" <guix-patches-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
X-Migadu-To: larch@yhetil.org
X-Migadu-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1647429453;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:resent-cc:
	 resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post; bh=nn1wj31qp8yKvitPCmKc6CXVGEdjDzsyMu92Gl3FXp4=;
	b=ae4xegvtI66isSoSdy9EMyfQu2912pYXCbJ3Ab85VoYpNaTunMDFYtKqq9jbzMmxb+iZdn
	NNHhvnVuAG8mqaSRsIE0hLtDtZqHN9UyaJ58meQR73b5YG9eneQt1k270JOwzC3qE1tbut
	s949eoMZgaorCxEW5N4OpvV7qxBKFicWpXY23y1/Gxx08dsGNkU0i0540lLRktNtxZ7aYW
	3P2azWFEKE15DEqM7FFzBcdqs0kc53BsycIoKGIOqyPDOShjtMe7z6KxuN1g6NWTZcUDmQ
	sEEueI8Q6cqNFIsmkKmiW7cq5aLGD47JspDKRITBzo91IjGm+uRuKi2+jKcBxQ==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647429453; a=rsa-sha256; cv=none;
	b=tLMqihGMX6O9n8CwAnRWtSM5XGd9Tc9fbnV13skqxcrTf4NoJDzheg+vuVDzoAy2KuqaKe
	sEb8NY1NY0G/LTG2m2uuDP4To3yoTdH1tjsU5Zo7EsJ7uBKw9Fj9TxwFN0Mm2+BWcy5iBc
	L5nC1FrqDjFrrOpwrSPQOkXkmg5YUsoPGSxmJm5YdfehQ0ybl0n6G9GzzKjdBGKpHOZRAq
	y1hLaXbNaBjGG2uYp2XqmDf5JevSLc8LwjG+lGIrS0Z7ZyCnSk5oANtUgo68Tq0SYQWCOI
	V/234rZaGlNWqt3dSLyhjWd0JzFGNsLAU+yvTrq4tuCsyR+nY39eJMaIcbCcag==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=none;
	dmarc=none;
	spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Spam-Score: -3.76
Authentication-Results: aspmx1.migadu.com;
	dkim=none;
	dmarc=none;
	spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Queue-Id: AAC7829987
X-Spam-Score: -3.76
X-Migadu-Scanner: scn0.migadu.com
X-TUID: PTAE2JE5mVW6

Hi Liliana,

Did you have something along these lines in mind?

I wanted to add the `create-notmuch-config` phase after the `enter-python-dir`,
but I don't know how to get the source folder from there. I suppose
there's a way to get the `../../` of the `cwd`, but I don't (yet) know how.

The generated contains the expected paths:

```
NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/version.txt'
NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
```

… but they **always** reference `drv-0`, even if it's not the first build!?
For instance:

```
$ cat /tmp/guix-build-python-notmuch2-0.35.drv-6/notmuch-0.35/bindings/python-cffi/_notmuch_config.py                                                                                                                      [profile] guix-dev
NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/version.txt'
NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
```

Does it matter?!

Regards,

--
Tanguy
---
 gnu/packages/mail.scm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d253ca7011..f6769cad02 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -28,7 +28,7 @@
 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
 ;;; Copyright © 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2019, 2020, 2021 Tanguy Le Carrour <tanguy@bioneland.org>
+;;; Copyright © 2019, 2020-2022 Tanguy Le Carrour <tanguy@bioneland.org>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2020 Justus Winter <justus@sequoia-pgp.org>
 ;;; Copyright © 2020 Eric Brown <ecbrown@ericcbrown.com>
@@ -1490,9 +1490,21 @@ (define-public python-notmuch2
     (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 'create-notmuch-config
+           (lambda _
+             (let ((cwd (getcwd)))
+               (with-output-to-file "bindings/python-cffi/_notmuch_config.py"
+                 (lambda _
+                   (display
+                    (string-append
+                     "NOTMUCH_VERSION_FILE='" cwd "/version.txt'\n"
+                     "NOTMUCH_INCLUDE_DIR='" cwd "/lib'\n"
+                     "NOTMUCH_LIB_DIR='" cwd "/lib'")))))))
          ;; 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 'create-notmuch-config 'enter-python-dir
            (lambda _ (chdir "bindings/python-cffi"))))))
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))
-- 
2.34.0