Subject: guix build mixes build dirs?

From: Robert Vollmert <[email-masked]>
Date: Sun, 30 Jun 2019 12:24:16 +0200

So this is pretty bizarre, and I haven’t managed to cut it down
to a smaller example yet, but it seems pretty clear that something
is broken:

$ guix build -K some-package
-> error, referencing /tmp/guix-build-puzzledb-frontend-20190625-git.drv-0
note: keeping build directory `/tmp/guix-build-puzzledb-frontend-20190625-git.drv-0’
$ guix build -K some-package
-> same error, again referencing /tmp/guix-build-puzzledb-frontend-20190625-git.drv-0
note: keeping build directory `/tmp/guix-build-puzzledb-frontend-20190625-git.drv-1’

My concrete packaging setup is a bit more complicated. I’m working with elm, and
faking the build directory as the home directory. The error message mentioned above
is

> The binary data at
> /tmp/guix-build-puzzledb-frontend-20190625-git.drv-0/.elm/0.19.0/package/versions.dat
> is corrupt.

Elm caches build artifacts in the following directories:

    /tmp/guix-build-puzzledb-frontend-20190625-git.drv-0/.elm
    elm-stuff/

while the package definition uses the trivial build system as such:

    (arguments
     `(#:modules ((guix build utils) (build-elm) (json parser) (versions))
       #:builder
         (begin
             …
             (setenv "HOME" (getcwd))
             (setenv "HTTP_PROXY" ".”) ; break http access
             (copy-recursively (assoc-ref %build-inputs "source") "src")
             (with-directory-excursion “src"
               …
               (invoke elm "make" "--output=../all.js" "src/All.elm”)))

The path in the error above comes from $HOME — is there a chance that this gets saved
somewhere? Other parts of the build script appear to work with the -1 directory as
expected.

I’m not at all sure that my package definition is even close to correct, but as far
as I can tell, a mix-up as above should be impossible.