Subject: bug#36511: extraneous recompiles of scm files while editing gnu/packages/

From: Robert Vollmert <[email-masked]>
Date: Tue, 9 Jul 2019 17:45:18 +0200

Hi Ludo’,

thanks for looking into this!

On 9. Jul 2019, at 00:15, Ludovic Courtès <[email-masked]> wrote:
> Robert Vollmert <[email-masked]> skribis:
>> Here’s another example, while working on a local checkout of a channel.
>> Calling `guild compile` just makes things worse.
>> 
>> $ rm -rf ~/.cache/guile
>> $ guix build -L . -L ../guix-postgrest puzzledb-frontend
>> ;;; note: source file ../guix-postgrest/bytestring.scm
>> ;;;       newer than compiled /gnu/store/sk1j6fkh855cm6ypp6799pgf8wvnlk76-postgrest/lib/guile/2.2/site-ccache/bytestring.go
>> ;;; note: source file ../guix-postgrest/check.scm
>> ;;;       newer than compiled /gnu/store/sk1j6fkh855cm6ypp6799pgf8wvnlk76-postgrest/lib/guile/2.2/site-ccache/check.go
> 
> That’s bad (it’s even worse than having to type ‘make’ in the
> development environment IMO because it’s a “user-facing” interface.)
> 
> How about the patch below?  That turns on auto-compilation, which is
> probably a good thing in this context; as a side-effect, messages like
> those above should disappear.
> 
> The only downside is ABI breakage: if we change the ABI of the <package>
> record type (which is quite rare), then your channel code will no longer
> run; you’ll get a message like:
> 
>  "<package>: record ABI mismatch; recompilation needed"
> 
> and you’ll have to “rm -rf ~/.cache/guile”.
> 
> Actually we could probably catch ‘record-abi-mismatch-error’ and
> auto-compile when that happens.

I’ve applied your patch and am testing it now. At first glance it doesn’t
improve the situation, compare the output below of running `guix build -L .`
similar to before, after having edited check.scm.

$ guix build -L . postgrest
;;; note: source file ./bytestring.scm
;;;       newer than compiled /gnu/store/v5a8qdcpp32ymfdasfql6n0g13zjkrb9-postgrest/lib/guile/2.2/site-ccache/bytestring.go
;;; found fresh local cache at /home/rob/.cache/guile/ccache/2.2-LE-8-3.A/home/rob/guix-postgrest/bytestring.scm.go
;;; note: source file ./check.scm
;;;       newer than compiled /gnu/store/v5a8qdcpp32ymfdasfql6n0g13zjkrb9-postgrest/lib/guile/2.2/site-ccache/check.go
;;; note: source file ./check.scm
;;;       newer than compiled /home/rob/.cache/guile/ccache/2.2-LE-8-3.A/home/rob/guix-postgrest/check.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling ./check.scm
;;; note: source file ./control.scm
;;;       newer than compiled /gnu/store/v5a8qdcpp32ymfdasfql6n0g13zjkrb9-postgrest/lib/guile/2.2/site-ccache/control.go
;;; found fresh local cache at /home/rob/.cache/guile/ccache/2.2-LE-8-3.A/home/rob/guix-postgrest/control.scm.go
;;; note: source file ./text.scm
[…]

Cheers
Robert