summary refs log tree commit diff
path: root/tests/store-database.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-07 21:55:15 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-14 11:17:00 +0200
commitef1297e8c74a0358d2538a5dd43d50cde7bf14a3 (patch)
tree1ffe41c4ba71c30a4d10a0f90eec9124359c6169 /tests/store-database.scm
parentc45477d2a1a651485feede20fe0f3d15aec48b39 (diff)
downloadguix-ef1297e8c74a0358d2538a5dd43d50cde7bf14a3.tar.gz
database: 'sqlite-register' takes a database, not a file name.
* guix/store/database.scm (sqlite-register): Remove #:db-file and add
'db' parameter.  Remove #:schema and 'parameterize'.
(register-path): Wrap 'sqlite-register' call in 'with-database' and in
'parameterize'.
* tests/store-database.scm ("new database")
("register-path with unregistered references"): Adjust accordingly.
Diffstat (limited to 'tests/store-database.scm')
-rw-r--r--tests/store-database.scm40
1 files changed, 20 insertions, 20 deletions
diff --git a/tests/store-database.scm b/tests/store-database.scm
index 9562055fd1..22c356679b 100644
--- a/tests/store-database.scm
+++ b/tests/store-database.scm
@@ -57,20 +57,20 @@
   (call-with-temporary-output-file
    (lambda (db-file port)
      (delete-file db-file)
-     (sqlite-register #:db-file db-file
-                      #:path "/gnu/foo"
-                      #:references '()
-                      #:deriver "/gnu/foo.drv"
-                      #:hash (string-append "sha256:" (make-string 64 #\e))
-                      #:nar-size 1234)
-     (sqlite-register #:db-file db-file
-                      #:path "/gnu/bar"
-                      #:references '("/gnu/foo")
-                      #:deriver "/gnu/bar.drv"
-                      #:hash (string-append "sha256:" (make-string 64 #\a))
-                      #:nar-size 4321)
-     (let ((path-id (@@ (guix store database) path-id)))
-       (with-database db-file db
+     (with-database db-file db
+       (sqlite-register db
+                        #:path "/gnu/foo"
+                        #:references '()
+                        #:deriver "/gnu/foo.drv"
+                        #:hash (string-append "sha256:" (make-string 64 #\e))
+                        #:nar-size 1234)
+       (sqlite-register db
+                        #:path "/gnu/bar"
+                        #:references '("/gnu/foo")
+                        #:deriver "/gnu/bar.drv"
+                        #:hash (string-append "sha256:" (make-string 64 #\a))
+                        #:nar-size 4321)
+       (let ((path-id (@@ (guix store database) path-id)))
          (list (path-id db "/gnu/foo")
                (path-id db "/gnu/bar")))))))
 
@@ -83,12 +83,12 @@
      (delete-file db-file)
      (catch 'sqlite-error
        (lambda ()
-         (sqlite-register #:db-file db-file
-                          #:path "/gnu/foo"
-                          #:references '("/gnu/bar")
-                          #:deriver "/gnu/foo.drv"
-                          #:hash (string-append "sha256:" (make-string 64 #\e))
-                          #:nar-size 1234)
+         (with-database db-file db
+           (sqlite-register db #:path "/gnu/foo"
+                            #:references '("/gnu/bar")
+                            #:deriver "/gnu/foo.drv"
+                            #:hash (string-append "sha256:" (make-string 64 #\e))
+                            #:nar-size 1234))
          #f)
        (lambda args
          (pk 'welcome-exception! args)