Hi Maxim,
On Fri, 15 Jul 2022 at 15:53, Maxim Cournoyer wrote:
> I was toying with the idea to programatically enable tracing the
> execution of a single build phase to aid with debugging, and came up
> with this with the help of robin on #guix (thanks!)
Well, I am often annoyed when debugging a package and I usually use
“guix build -K” and then jump in /tmp/guix--XY. The most
annoying is to re-run all the previous phases when they are somehow
already available under /tmp/. And often, this re-run is just for
tweaking the recipe to have more context about the failure…
> --8<---cut here---start->8---
> @@ -4349,7 +4349,19 @@ (define-public vala
> (substitute* "valadoc/tests/libvaladoc\
> /tests-extra-environment.sh"
> (("export PKG_CONFIG_PATH=" m)
> -(string-append m "$PKG_CONFIG_PATH:"
> +(string-append m "$PKG_CONFIG_PATH:")
> +
> + (replace 'glib-or-gtk-wrap
> + (lambda args
> + (use-modules (system vm trace)
> + (system vm vm))
> + (call-with-vm
> + (lambda ()
> +(set-vm-engine! 'debug)
> +(call-with-trace
> + (lambda _
> +(apply (assoc-ref %standard-phases 'glib-or-gtk-wrap)
> + args))
> (native-inputs
> `(("bison" ,bison)
> ("dbus" ,dbus) ; for dbus tests
> --8<---cut here---end--->8---
…so maybe we could have something like that for a better tracing.
Maybe, we could imagine an option as “guix build --list-phases” and then
a kind of package transformation doing on-the-fly the “call-with-vm” –
available with an option as “guix build --trace=glib-or-gtk-wrap”.
> Unfortunately it doesn't cause any trace to be output. Is there
> something missing to the above incantation, perhaps?
Sadly, I do not know.
Cheers,
simon