aboutsummaryrefslogtreecommitdiff
path: root/buildbot-build.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2023-03-23 09:21:56 +1100
committerYuchen Pei <hi@ypei.me>2023-03-23 09:21:56 +1100
commit7cc017ccc12921e38d0ace50400e096a4f6ddd2b (patch)
treed0d39a1cce41f0ea3aab077d0aa6b79f95bb0c12 /buildbot-build.el
parentf9792cdcfab9b2728b3db8152e62e119b135b7ac (diff)
added buildbot build mode
Diffstat (limited to 'buildbot-build.el')
-rw-r--r--buildbot-build.el39
1 files changed, 39 insertions, 0 deletions
diff --git a/buildbot-build.el b/buildbot-build.el
index ca1a8bc..a6c2b09 100644
--- a/buildbot-build.el
+++ b/buildbot-build.el
@@ -1,4 +1,43 @@
+(require 'buildbot-client)
(define-derived-mode buildbot-build-mode special-mode "Buildbot build"
"Buildbot view for a build")
+(defvar-local buildbot-build-build-id nil)
+(defvar-local buildbot-build-info nil)
+(defun buildbot-build-buffer-name (buildid)
+ (concat "*buildbot build " (number-to-string buildid) "*"))
+
+(defun buildbot-build-load (buildid)
+ (let ((buffer-name (buildbot-build-buffer-name buildid)))
+ (with-current-buffer (get-buffer-create buffer-name)
+ (buildbot-build-mode)
+ (setq buildbot-build-build-id buildid)
+ (buildbot-build-update))
+ (switch-to-buffer buffer-name)))
+
+(defun buildbot-build-update ()
+ (unless (derived-mode-p 'buildbot-build-mode)
+ (error "Not in buildbot build mode"))
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (let ((steps (buildbot-get-steps-by-buildid buildbot-build-build-id)))
+ (insert (buildbot-build-format steps))
+ (goto-char (point-min)))))
+
+(defun buildbot-build-open (buildid)
+ (interactive "sBuildi ID: ")
+ (buildbot-build-load (string-to-number buildid)))
+
+(defun buildbot-build-format (steps)
+ (string-join
+ (mapcar 'buildbot-build-format-step steps)
+ "\n"))
+
+(defun buildbot-build-format-step (step)
+ (propertize
+ (format "\n[%d %s %s]\n"
+ (alist-get 'number step)
+ (alist-get 'name step)
+ (alist-get 'state_string step))))
+
(provide 'buildbot-build)