Subject: bug#58567: Grafting affects origins

From: Ludovic Courtès <[email-masked]>
Date: Mon, 17 Oct 2022 15:42:58 +0200

Hi,

Marius Bakke <[email-masked]> skribis:

> As an example, as of commit 3d8c243efb615c7e642942433be1c7badf0ae65e,
> 'guix build -d telegram-desktop' produces:
>
>   /gnu/store/q1gx5xaszlyyr0sx663c2qkx92cqbr4r-telegram-desktop-4.2.2.drv
>
> If we open that graft derivation, we see that it depends on:
>
>   /gnu/store/92bl6qmj5r0byc59fykvlfaqmw6ikvy8-telegram-desktop-4.2.2.drv
>
> However:
>
>   $ guix build -d --no-grafts telegram-desktop
>   /gnu/store/4vbj4gblmwvl645z1q3aaxfhckjqi3kg-telegram-desktop-4.2.2.drv

The differences between these two are:

--- #<buffer vv1f598yc17rl08059625cw61ig0c3k0-telegram-desktop-4.2.2-builder>
+++ #<buffer qjw2k2dzvw51rxa5k9mr7i41ql4gwr28-telegram-desktop-4.2.2-builder>
@@ -44,7 +44,7 @@
 	      ("abseil-cpp" . "/gnu/store/lsrda46kb137fnwslwhg9bpqgnakasy8-abseil-cpp-20220623.1")
 	      ("alsa-lib" . "/gnu/store/nfxcjvv9c2q6in9x52kkkayqv38k00ai-alsa-lib-1.2.4")
 	      ("c++-gsl" . "/gnu/store/bpszfya32r8zj0rhaijckh5bj6fmj709-c++-gsl-3.1.0")
-	      ("fcitx-qt5" . "/gnu/store/swyjasxcnlbxavpaiaginsyzr1gdpban-fcitx-qt5-1.2.6")
+	      ("fcitx-qt5" . "/gnu/store/k184g9bj05zz0lnz7j5h1zsrjavdadwp-fcitx-qt5-1.2.6")
 	      ("fcitx5-qt" . "/gnu/store/cbpycbi5r23dgwl7k20g6h0kkmznz7pz-fcitx5-qt-5.0.7")
 	      ("ffmpeg" . "/gnu/store/jhd8y6a2j9jcx0icq25qdhs1m8i8qfy7-ffmpeg-4.4.2")
 	      ("glib" . "/gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2")
@@ -250,7 +250,7 @@
 		  (quote glib-or-gtk-wrap)
 		(assoc-ref glib-or-gtk:%standard-phases
 			   (quote glib-or-gtk-wrap))))
-	    #:qtbase "/gnu/store/ir6lpakwwj897lbjfn4n9kmxiqxs377l-qtbase-5.15.5" #:qt-wrap-excluded-outputs
+	    #:qtbase "/gnu/store/w66rzihchl7n9d1zpr2qvgiyd58zr2pp-qtbase-5.15.5" #:qt-wrap-excluded-outputs
 	    (quote
 	     ())
 	    #:qt-wrap-excluded-inputs

I believe that’s a bug in ‘qt-build-system’: like ‘gnu-build-system’, it
should pass #:graft? #f (patch below).  Failing that, it’ll end up using
a different #:qtbase depending on whether or not grafts are enabled.

Does that make sense?

I found a similar issue in ‘python-build-system’ in
<https://issues.guix.gnu.org/58579>.

Thanks,
Ludo’.

diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm
index a9bf728f25..7e3a54f1f8 100644
--- a/guix/build-system/qt.scm
+++ b/guix/build-system/qt.scm
@@ -181,6 +181,7 @@ (define builder
   (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
                                                   system #:graft? #f)))
     (gexp->derivation name builder
+                      #:graft? #f                 ;consistent with 'gnu-build'
                       #:system system
                       #:guile-for-build guile)))
 
@@ -269,6 +270,7 @@ (define %outputs
   (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
                                                   system #:graft? #f)))
     (gexp->derivation name builder
+                      #:graft? #f                 ;consistent with 'gnu-build'
                       #:system system
                       #:guile-for-build guile)))