aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2017-07-31 19:25:28 +0200
committerMathieu Othacehe <m.othacehe@gmail.com>2017-09-08 21:00:57 +0200
commite550cb6a9a9c8b42f9be88cc49d7b72232097045 (patch)
tree848641ed7b4fd4733ea43e02d5dabbf195472ed7 /bin
parent7cee071e503ae2c68ba49dc494a4db759e1dd555 (diff)
downloadcuirass-e550cb6a9a9c8b42f9be88cc49d7b72232097045.tar
cuirass-e550cb6a9a9c8b42f9be88cc49d7b72232097045.tar.gz
cuirass: Store new information in database to prepare new HTTP API
integration. * bin/evaluate.in (fill-job): New procedure. (main): Use it to fill informations (nix-name, system) that will later be added to database. * doc/cuirass.texi (Database)[Derivation]: Add system and nix_name fields. (Database)[Builds]: Add id, status, timestamp, starttime and stoptime fields. Remove output field. (Database)[Outputs]: New table describing the build outputs. * src/cuirass/base.scm (build-packages): Add new fields to build object before adding it to database. * src/cuirass/database.scm (db-get-build, db-get-builds): New procedures to get a build by id from database and a list of builds using filter parameters respectively. * src/schema.sql (Outputs) : New table. (Derivations): Add system and nix_name columns. (Builds): Remove output column and add id, status, timestamp, starttime and stoptime columns.
Diffstat (limited to 'bin')
-rw-r--r--bin/evaluate.in17
1 files changed, 15 insertions, 2 deletions
diff --git a/bin/evaluate.in b/bin/evaluate.in
index d1d0767..37ba493 100644
--- a/bin/evaluate.in
+++ b/bin/evaluate.in
@@ -28,9 +28,21 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(use-modules (cuirass)
(ice-9 match)
(ice-9 pretty-print)
+ (srfi srfi-26)
(guix build utils)
+ (guix derivations)
(guix store))
+(define (fill-job job eval-id)
+ "Augment the JOB alist with EVAL-ID and additional information
+ gathered from JOB’s #:derivation."
+ (let ((drv (read-derivation-from-file
+ (assq-ref job #:derivation))))
+ `((#:eval-id . ,eval-id)
+ (#:nix-name . ,(derivation-name drv))
+ (#:system . ,(derivation-system drv))
+ ,@job)))
+
(define* (main #:optional (args (command-line)))
(match args
((command load-path guix-package-path cachedir specstr database)
@@ -73,8 +85,9 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(pretty-print
(map (lambda (thunk)
(let* ((job (call-with-time-display thunk))
- ;; Keep track of SPEC id in the returned jobs.
- (job* (acons #:eval-id eval-id job)))
+ ;; Fill job with informations that will later be
+ ;; added to database.
+ (job* (fill-job job eval-id)))
(db-add-derivation db job*)
job*))
thunks)