Message ID | 20220316111624.26189-1-tanguy@bioneland.org |
---|---|
State | Accepted |
Headers | show |
Series | [bug#54396,v2,WIP] gnu: python-notmuch2: Fix build. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Am Mittwoch, dem 16.03.2022 um 12:16 +0100 schrieb Tanguy Le Carrour: > 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?! Yes, it does matter. The cwd you reference will no longer exist when the bindings are installed. The purpose of generating the file is to fill it with useful, persisting data, i.e. (dirname (search-input-file inputs "notmuch.h")) and (dirname (search-input-file inputs "libnotmuch.so")). As for the version file, that should probably be set to an error value such as None or NotImplemented or even unset. It does not appear to be currently used and we don't install any such file for notmuch. Cheers
Hi Liliana, Quoting Liliana Marie Prikler (2022-03-16 12:28:49) > Am Mittwoch, dem 16.03.2022 um 12:16 +0100 schrieb Tanguy Le Carrour: > > The generated contains the expected paths: > > […] > > > > … 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 > > 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?! > Yes, it does matter. The cwd you reference will no longer exist when > the bindings are installed. The purpose of generating the file is to > fill it with useful, persisting data, Oh, I thought it was only used at build time! Sorry, my mistake! > i.e. (dirname (search-input-file inputs "notmuch.h")) and > (dirname (search-input-file inputs "libnotmuch.so")). Unfortunately, I couldn't make those work. :-( So I ended up with a less "sexy" version: ``` "NOTMUCH_INCLUDE_DIR='" (assoc-ref inputs "notmuch") "/include/notmuch.h" "'\n" "NOTMUCH_LIB_DIR='" (assoc-ref inputs "notmuch") "/lib/libnotmuch.so" "'" ``` > As for the version file, that should probably be > set to an error value such as None or NotImplemented or even unset. It > does not appear to be currently used and we don't install any such file > for notmuch. If I set `NOTMUCH_VERSION_FILE=''`, I get a "file does not exist" error at build time. So I decided to set it to `/dev/null` instead. Or would it be better if I patched `notmuch` to create the actual version file?! Thanks again for your precious help!
Hi, Am Mittwoch, dem 16.03.2022 um 14:46 +0100 schrieb Tanguy LE CARROUR: > Hi Liliana, > [...] > > > i.e. (dirname (search-input-file inputs "notmuch.h")) and > > (dirname (search-input-file inputs "libnotmuch.so")). > > Unfortunately, I couldn't make those work. :-( > > So I ended up with a less "sexy" version: > > ``` > "NOTMUCH_INCLUDE_DIR='" (assoc-ref inputs "notmuch") > "/include/notmuch.h" "'\n" > "NOTMUCH_LIB_DIR='" (assoc-ref inputs "notmuch") "/lib/libnotmuch.so" > "'" > ``` That is actually a mistake on my part, search-input-file should search inputs for "include/notmuch.h" and likewise "lib/libnotmuch.so". The dirname is important here, since both constants want directories. Alternatively, forgoing those constants might be a good idea, but is not worth investing too much time in. > > As for the version file, that should probably be set to an error > > value such as None or NotImplemented or even unset. It does not > > appear to be currently used and we don't install any such file > > for notmuch. > > If I set `NOTMUCH_VERSION_FILE=''`, I get a "file does not exist" > error at build time. So I decided to set it to `/dev/null` instead. > Or would it be better if I patched `notmuch` to create the actual > version file?! I think you ought to debug the build and short-circuit the logic by inferring the version number directly where it is needed. Without actual build output that's as much as I can propose. Cheers
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+)))