~ruther/guix-local

529dce6e98c22f00052df231414bca4f86e02094 — Ludovic Courtès 5 months ago eb83cce
inferior: Caching works by checking the mtime, not the atime.

Mounting file systems with ‘noatime’ is common.  Thus, avoid relying on the
atime.

* guix/inferior.scm (cached-channel-instance): Pass ‘stat:mtime’ to
‘file-expiration-time’.  When ‘cached’ exists, call ‘utime’ to update its
mtime and atime.

Change-Id: Ib9bff45ed402260fdead3c23f09b431fa369e741
1 files changed, 6 insertions(+), 3 deletions(-)

M guix/inferior.scm
M guix/inferior.scm => guix/inferior.scm +6 -3
@@ 952,18 952,21 @@ X.509 host certificate; otherwise, warn about the problem and keep going."
  (maybe-remove-expired-cache-entries cache-directory
                                      cache-entries
                                      #:entry-expiration
                                      (file-expiration-time ttl))
                                      (file-expiration-time ttl stat:mtime))

  ;; Clean the legacy cache directory as well.  Remove this call once at least
  ;; one year has passed.
  (maybe-remove-expired-cache-entries %legacy-inferior-cache-directory
                                      cache-entries
                                      #:entry-expiration
                                      (file-expiration-time ttl))
                                      (file-expiration-time ttl stat:mtime))


  (if (file-exists? (cached commits))
      (cached commits)
      (let ((now (current-time)))
        ;; Update the mtime on CACHED to reflect usage.
        (utime cached now now 0 0 AT_SYMLINK_NOFOLLOW)
        cached)
      (run-with-store store
        (mlet* %store-monad ((instances
                              -> (latest-channel-instances store channels