diff options
author | Caleb Ristvedt <caleb.ristvedt@cune.org> | 2019-02-13 02:19:42 -0600 |
---|---|---|
committer | Caleb Ristvedt <caleb.ristvedt@cune.org> | 2020-04-13 13:14:50 -0500 |
commit | 14499efc250282cd0fc305fe19a927feb26d1916 (patch) | |
tree | a19681fd13427df33dd175b1efa51dea2e97e8d5 /tests | |
parent | bdc366cbdce59ddc22dfa1bc70d5c49a0b6dcf92 (diff) | |
download | guix-14499efc250282cd0fc305fe19a927feb26d1916.tar.gz |
guix: store: Register derivation outputs.
* guix/store/database.scm (register-output-sql, derivation-outputs-sql): new variables. (registered-derivation-outputs): new procedure. ((guix store derivations), (guix store files)): used for <derivation> and derivation-path?, respectively. (register-items): if item is a derivation, also register its outputs. * tests/store-database.scm (register-path): first register a dummy derivation for the test file, and check that its outputs are registered in the DerivationOutputs table and are equal to what was specified in the dummy derivation.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/store-database.scm | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/store-database.scm b/tests/store-database.scm index 4d91884250..d5fb916586 100644 --- a/tests/store-database.scm +++ b/tests/store-database.scm @@ -20,6 +20,7 @@ #:use-module (guix tests) #:use-module (guix store) #:use-module (guix store database) + #:use-module (guix derivations) #:use-module ((guix utils) #:select (call-with-temporary-output-file)) #:use-module (srfi srfi-26) #:use-module (srfi srfi-64)) @@ -44,14 +45,41 @@ (drv (string-append file ".drv"))) (call-with-output-file file (cut display "This is a fake store item.\n" <>)) + (when (valid-path? %store drv) + (delete-paths %store (list drv))) + (call-with-output-file drv + (lambda (port) + ;; XXX: we should really go from derivation to output path as is + ;; usual, currently any verification done on this derivation will + ;; cause an error. + (write-derivation ((@@ (guix derivations) make-derivation) + ;; outputs + (list (cons "out" + ((@@ (guix derivations) + make-derivation-output) + file + #f + #f + #f))) + ;; inputs sources system builder args + '() '() "" "" '() + ;; env-vars filename + '() drv) + port))) + (register-path drv) (register-path file #:references (list ref) #:deriver drv) (and (valid-path? %store file) (equal? (references %store file) (list ref)) - (null? (valid-derivers %store file)) + ;; We expect the derivation outputs to be automatically + ;; registered. + (not (null? (valid-derivers %store file))) (null? (referrers %store file)) + (equal? (with-database %default-database-file db + (registered-derivation-outputs db drv)) + `(("out" . ,file))) (list (stat:mtime (lstat file)) (stat:mtime (lstat ref))))))) |