I'm trying to build an Emacs package of my local git checkout:

--8<---------------cut here---------------start------------->8---
(define-public emacs-dev
    (inherit emacs)
    (name "emacs-dev")
    (version "27.0.0")
    (source (local-file "/home/ambrevar/projects/emacs" #:recursive? #t))
     `(#:tests? #f               ; TODO: Enable tests?  Need to fix tramp first.
                (modify-phases %standard-phases
                  (delete 'reset-gzip-timestamps) ; TODO: Why does this fail?
                  (delete 'build))))
    (synopsis "Emacs (development version)")
    (license license:lgpl3+)))
--8<---------------cut here---------------end--------------->8---

The above declaration works on a clean checkout (e.g. after a `make

When developing and building locally multiple times, it is more
efficient to only run the install phase during Guix packaging.

Emacs is based on the GNU build system which on Guix uses a separate
"source" and "build" folder.  Unfortunately, some Emacs files are
generated during the build phase inside the "source" folder no matter
what.  (Am I wrong about that?)

Since all file timestamps are set to Epoch by 'unpack', the build phase
tries to rebuild everything.
And since the files unpacked to "source" are read-only, `make` fails to
regenerate the files that go in "source".

Excerpt from the build log:

--8<---------------cut here---------------start------------->8---
make -C ../admin/charsets all
make[2]: Entering directory 
  GEN      ../../../source/etc/charsets/JISX2131.map
/gnu/store/icz3hd36aqpjz5slyp4hhr8wsfbgiml1-bash-minimal-4.4.12/bin/bash: line 
2: ../../../source/etc/charsets/JISX2131.map: Permission denied
--8<---------------cut here---------------end--------------->8---

And the offending files details (notice the permissions and the mtime):

- Source /home/ambrevar/projects/emacs/etc/charsets/JISX2131.map:
-rw-r--r--   1 ambrevar       users    120k 2018-05-17 15:08 JISX2131.map

- Destination 
-r--r--r--   1 ambrevar       users    120k 1970-01-01  1970 JISX2131.map

The same error occurs for all the generated files (mostly .map files and
stamp files).

From the source, 'unpack' is supposed to preserve the timestamp:

--8<---------------cut here---------------start------------->8---
(define* (unpack #:key source #:allow-other-keys)
  "Unpack SOURCE in the working directory, and change directory within the
source.  When SOURCE is a directory, copy it in a sub-directory of the current
working directory."
  (if (file-is-directory? source)
        (mkdir "source")
        (chdir "source")

        ;; Preserve timestamps (set to the Epoch) on the copied tree so that
        ;; things work deterministically.
        (copy-recursively source "."
                          #:keep-mtime? #t)
      (and (if (string-suffix? ".zip" source)
               (zero? (system* "unzip" source))
               (zero? (system* "tar" "xvf" source)))
           (chdir (first-subdirectory ".")))))
--8<---------------cut here---------------end--------------->8---


Pierre Neidhardt

Attachment: signature.asc
Description: PGP signature

Reply via email to