ci: Represent build status as a symbol.
* guix/ci.scm (define-enumeration-mapping): New macro. (integer->build-status): New procedure. (<build>)[status]: Use it.
This commit is contained in:
parent
a2b22cae4f
commit
77dba2281f
20
guix/ci.scm
20
guix/ci.scm
@ -75,13 +75,31 @@
|
|||||||
(file-size build-product-file-size) ;integer
|
(file-size build-product-file-size) ;integer
|
||||||
(path build-product-path)) ;string
|
(path build-product-path)) ;string
|
||||||
|
|
||||||
|
(define-syntax-rule (define-enumeration-mapping proc
|
||||||
|
(names integers) ...)
|
||||||
|
(define (proc value)
|
||||||
|
(match value
|
||||||
|
(integers 'names) ...)))
|
||||||
|
|
||||||
|
(define-enumeration-mapping integer->build-status
|
||||||
|
;; Copied from 'build-status' in Cuirass.
|
||||||
|
(submitted -3)
|
||||||
|
(scheduled -2)
|
||||||
|
(started -1)
|
||||||
|
(succeeded 0)
|
||||||
|
(failed 1)
|
||||||
|
(failed-dependency 2)
|
||||||
|
(failed-other 3)
|
||||||
|
(canceled 4))
|
||||||
|
|
||||||
(define-json-mapping <build> make-build build?
|
(define-json-mapping <build> make-build build?
|
||||||
json->build
|
json->build
|
||||||
(id build-id "id") ;integer
|
(id build-id "id") ;integer
|
||||||
(derivation build-derivation) ;string | #f
|
(derivation build-derivation) ;string | #f
|
||||||
(evaluation build-evaluation) ;integer
|
(evaluation build-evaluation) ;integer
|
||||||
(system build-system) ;string
|
(system build-system) ;string
|
||||||
(status build-status "buildstatus" ) ;integer
|
(status build-status "buildstatus" ;symbol
|
||||||
|
integer->build-status)
|
||||||
(timestamp build-timestamp) ;integer
|
(timestamp build-timestamp) ;integer
|
||||||
(products build-products "buildproducts" ;<build-product>*
|
(products build-products "buildproducts" ;<build-product>*
|
||||||
(lambda (products)
|
(lambda (products)
|
||||||
|
Loading…
Reference in New Issue
Block a user