[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
15/16: database: Honor 'SOURCE_DATE_EPOCH'.
From: |
guix-commits |
Subject: |
15/16: database: Honor 'SOURCE_DATE_EPOCH'. |
Date: |
Tue, 15 Dec 2020 11:33:02 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 9e6fe0e08fda67ab298ca33ef00ffbf078ce4dd9
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Dec 11 15:37:20 2020 +0100
database: Honor 'SOURCE_DATE_EPOCH'.
* guix/store/database.scm (timestamp): New procedure.
(sqlite-register): Use it as the default for #:time.
(register-items): Likewise for #:registeration-time.
---
guix/store/database.scm | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 4579b05..0a84bbd 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -323,8 +323,19 @@ ids of items referred to."
(sqlite-fold cons '() stmt))
references)))
+(define (timestamp)
+ "Return a timestamp, either the current time of SOURCE_DATE_EPOCH."
+ (match (getenv "SOURCE_DATE_EPOCH")
+ (#f
+ (current-time time-utc))
+ ((= string->number seconds)
+ (if seconds
+ (make-time time-utc 0 seconds)
+ (current-time time-utc)))))
+
(define* (sqlite-register db #:key path (references '())
- deriver hash nar-size time)
+ deriver hash nar-size
+ (time (timestamp)))
"Registers this stuff in DB. PATH is the store item to register and
REFERENCES is the list of store items PATH refers to; DERIVER is the '.drv'
that produced PATH, HASH is the base16-encoded Nix sha256 hash of
@@ -337,9 +348,7 @@ Every store item in REFERENCES must already be registered."
#:deriver deriver
#:hash hash
#:nar-size nar-size
- #:time (time-second
- (or time
- (current-time time-utc))))))
+ #:time (time-second time))))
;; Call 'path-id' on each of REFERENCES. This ensures we get a
;; "non-NULL constraint" failure if one of REFERENCES is unregistered.
(add-references db id
@@ -388,7 +397,7 @@ is true."
(define* (register-items db items
#:key prefix
- registration-time
+ (registration-time (timestamp))
(log-port (current-error-port)))
"Register all of ITEMS, a list of <store-info> records as returned by
'read-reference-graph', in DB. ITEMS must be in topological order (with
- 03/16: serialization: 'restore-file' sets canonical timestamp and permissions., (continued)
- 03/16: serialization: 'restore-file' sets canonical timestamp and permissions., guix-commits, 2020/12/15
- 07/16: database: Remove #:reset-timestamps? from 'register-items'., guix-commits, 2020/12/15
- 10/16: database: Remove #:deduplicate? from 'register-items'., guix-commits, 2020/12/15
- 06/16: image: 'register-closure' assumes already-reset timestamps., guix-commits, 2020/12/15
- 12/16: database: Remove #:deduplicate? and #:reset-timestamps? from 'register-path'., guix-commits, 2020/12/15
- 08/16: store-copy: 'populate-store' can optionally deduplicate files., guix-commits, 2020/12/15
- 04/16: nar: Deduplicate files right as they are restored., guix-commits, 2020/12/15
- 16/16: deduplicate: Create the '.links' directory lazily., guix-commits, 2020/12/15
- 05/16: store-copy: 'populate-store' resets timestamps., guix-commits, 2020/12/15
- 09/16: image: 'register-closure' leaves it up to the caller to deduplicate., guix-commits, 2020/12/15
- 15/16: database: Honor 'SOURCE_DATE_EPOCH'.,
guix-commits <=
- 13/16: system: 'init' does not recompute the hash of each store item., guix-commits, 2020/12/15
- 14/16: database: Remove 'register-path'., guix-commits, 2020/12/15
- 11/16: guix system: 'init' copies, resets timestamps, and deduplicates at once., guix-commits, 2020/12/15