unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* emacs-dev: 'unpack' phase does not seem to preserve timestamps
@ 2018-05-17 15:14 Pierre Neidhardt
  2018-05-23 15:01 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Neidhardt @ 2018-05-17 15:14 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 3372 bytes --]


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

--8<---------------cut here---------------start------------->8---
(define-public emacs-dev
  (package
    (inherit emacs)
    (name "emacs-dev")
    (version "27.0.0")
    (source (local-file "/home/ambrevar/projects/emacs" #:recursive? #t))
    (arguments
     `(#:tests? #f               ; TODO: Enable tests?  Need to fix tramp first.
                #:phases
                (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
clean`).

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 '/tmp/guix-build-emacs-dev-27.0.0.drv-0/build/admin/charsets'
  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 /tmp/guix-build-emacs-dev-27.0.0.drv-0/source/etc/charsets/JISX2131.map:
-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)
      (begin
        (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)
        #t)
      (and (if (string-suffix? ".zip" source)
               (zero? (system* "unzip" source))
               (zero? (system* "tar" "xvf" source)))
           (chdir (first-subdirectory ".")))))
--8<---------------cut here---------------end--------------->8---

Bug?

--
Pierre Neidhardt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-05-25 12:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-17 15:14 emacs-dev: 'unpack' phase does not seem to preserve timestamps Pierre Neidhardt
2018-05-23 15:01 ` Ludovic Courtès
2018-05-23 20:40   ` Pierre Neidhardt
2018-05-24 12:13     ` Ludovic Courtès
2018-05-24 12:29       ` Pierre Neidhardt
2018-05-24 20:33         ` Ludovic Courtès
2018-05-25 12:09           ` Pierre Neidhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).