2019-03-06 22:54:07 +00:00
|
|
|
(define-module (guix-data-service model build-status)
|
|
|
|
|
#:use-module (squee)
|
|
|
|
|
#:export (build-statuses
|
2019-03-17 22:44:09 +00:00
|
|
|
build-status-strings
|
2019-03-06 22:54:07 +00:00
|
|
|
insert-build-status))
|
|
|
|
|
|
|
|
|
|
(define build-statuses
|
|
|
|
|
'((-2 . "scheduled")
|
|
|
|
|
(-1 . "started")
|
|
|
|
|
(0 . "succeeded")
|
|
|
|
|
(1 . "failed")
|
|
|
|
|
(2 . "failed-dependency")
|
|
|
|
|
(3 . "failed-other")
|
|
|
|
|
(4 . "canceled")))
|
|
|
|
|
|
2019-03-17 22:44:09 +00:00
|
|
|
(define build-status-strings
|
|
|
|
|
(map cdr build-statuses))
|
|
|
|
|
|
2019-03-06 22:54:07 +00:00
|
|
|
(define (insert-build-status conn internal-build-id
|
|
|
|
|
starttime stoptime status)
|
|
|
|
|
(exec-query conn
|
|
|
|
|
(string-append
|
|
|
|
|
"INSERT INTO build_status "
|
|
|
|
|
"(internal_build_id, starttime, stoptime, status) "
|
|
|
|
|
"VALUES "
|
|
|
|
|
"(" internal-build-id ", "
|
|
|
|
|
(if (eq? starttime 0)
|
|
|
|
|
"NULL"
|
|
|
|
|
(string-append "to_timestamp("
|
|
|
|
|
(number->string starttime)
|
|
|
|
|
")"))
|
|
|
|
|
", "
|
|
|
|
|
(if (eq? stoptime 0)
|
|
|
|
|
"NULL"
|
|
|
|
|
(string-append "to_timestamp("
|
|
|
|
|
(number->string stoptime)
|
|
|
|
|
")"))
|
|
|
|
|
", "
|
|
|
|
|
"'" status "'"
|
|
|
|
|
")")))
|