aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-06-26 18:40:31 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-06-26 22:54:49 +0200
commit5ff38984e8a0b26bf3b97477158f55b3721ee2da (patch)
tree59adfad649f9cb44d50b4f512f17c6c8fccd7c82 /bin
parent5efdcb444139d6d9354c3aa740c3218beee75646 (diff)
downloadcuirass-5ff38984e8a0b26bf3b97477158f55b3721ee2da.tar
cuirass-5ff38984e8a0b26bf3b97477158f55b3721ee2da.tar.gz
Make %package-database a parameter object.
Move it to (cuirass database).
Diffstat (limited to 'bin')
-rw-r--r--bin/cuirass.in53
1 files changed, 26 insertions, 27 deletions
diff --git a/bin/cuirass.in b/bin/cuirass.in
index 87dd0ad..a998654 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -111,30 +111,29 @@ DIR if required."
(show-version progname)
(exit 0))
(else
- (let* ((specfile (option-ref opts 'file "tests/hello-subset.scm"))
- (dbfile (option-ref opts 'database %package-database))
- (specs (primitive-load specfile))
- (args (option-ref opts '() #f))
- (cachedir (if (null? args)
- (getenv "CUIRASS_CACHEDIR")
- (car args))))
- (db-close (db-init dbfile))
- (while #t
- (for-each
- (λ (spec)
- (fetch-repository cachedir spec)
- (let ((store ((guix-variable 'store 'open-connection)))
- (db (db-open dbfile)))
- (dynamic-wind
- (const #t)
- (lambda ()
- (let* ((jobs (evaluate store db cachedir spec))
- (set-build-options
- (guix-variable 'store 'set-build-options)))
- (set-build-options store #:use-substitutes? #f)
- (build-packages store jobs)))
- (lambda ()
- ((guix-variable 'store 'close-connection) store)
- (db-close db)))))
- specs)
- (sleep (string->number (option-ref opts 'interval "60")))))))))
+ (parameterize ((%package-database
+ (option-ref opts 'database (%package-database))))
+ (let* ((specfile (option-ref opts 'file "tests/hello-subset.scm"))
+ (specs (primitive-load specfile))
+ (args (option-ref opts '() #f))
+ (cachedir (if (null? args)
+ (getenv "CUIRASS_CACHEDIR")
+ (car args))))
+ (with-database db
+ (while #t
+ (for-each
+ (λ (spec)
+ (fetch-repository cachedir spec)
+ (let ((store ((guix-variable 'store 'open-connection))))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ (let* ((jobs (evaluate store db cachedir spec))
+ (set-build-options
+ (guix-variable 'store 'set-build-options)))
+ (set-build-options store #:use-substitutes? #f)
+ (build-packages store jobs)))
+ (lambda ()
+ ((guix-variable 'store 'close-connection) store)))))
+ specs)
+ (sleep (string->number (option-ref opts 'interval "60")))))))))))