aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model/build-status.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix-data-service/model/build-status.scm')
-rw-r--r--guix-data-service/model/build-status.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/guix-data-service/model/build-status.scm b/guix-data-service/model/build-status.scm
new file mode 100644
index 0000000..d6fde3a
--- /dev/null
+++ b/guix-data-service/model/build-status.scm
@@ -0,0 +1,36 @@
+(define-module (guix-data-service model build-status)
+ #:use-module (squee)
+ #:export (build-statuses
+ insert-build-status))
+
+(define build-statuses
+ '((-2 . "scheduled")
+ (-1 . "started")
+ (0 . "succeeded")
+ (1 . "failed")
+ (2 . "failed-dependency")
+ (3 . "failed-other")
+ (4 . "canceled")))
+
+(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 "'"
+ ")")))