diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-06-21 15:50:51 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-06-21 15:59:06 +0200 |
commit | 4c9243b688b4df2310b7fba65ef53e2f52f76bce (patch) | |
tree | de075522a8343b5f610909b141c7089ea4c11c38 | |
parent | 9270298f7521eb5ca654186c44a8b203f4584d62 (diff) | |
download | guix-4c9243b688b4df2310b7fba65ef53e2f52f76bce.tar guix-4c9243b688b4df2310b7fba65ef53e2f52f76bce.tar.gz |
hydra: 'evaluate' now validates job alists.
* build-aux/hydra/evaluate.scm (assert-valid-job): New procedure.
<top level>: Use it.
-rw-r--r-- | build-aux/hydra/evaluate.scm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/build-aux/hydra/evaluate.scm b/build-aux/hydra/evaluate.scm index afc7730ff2..ab10253f31 100644 --- a/build-aux/hydra/evaluate.scm +++ b/build-aux/hydra/evaluate.scm @@ -49,6 +49,17 @@ values." (/ (time-nanosecond time) 1e9))) (apply values results)))) +(define (assert-valid-job job thing) + "Raise an error if THING is not an alist with a valid 'derivation' entry. +Otherwise return THING." + (unless (and (list? thing) + (and=> (assoc-ref thing 'derivation) + (lambda (value) + (and (string? value) + (string-suffix? ".drv" value))))) + (error "job did not produce a valid alist" job thing)) + thing) + ;; Without further ado... (match (command-line) @@ -83,7 +94,9 @@ values." (map (lambda (job thunk) (format (current-error-port) "evaluating '~a'... " job) (force-output (current-error-port)) - (cons job (call-with-time-display thunk))) + (cons job + (assert-valid-job job + (call-with-time-display thunk)))) names thunks))) port)))) ((command _ ...) |