summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2018-07-18 23:40:22 +0300
committerAlex Kost <alezost@gmail.com>2018-07-27 12:14:24 +0300
commit63d9b64d5321f5a62806677be229512aacb01fed (patch)
treeb6c7e21c0c22098595eaff820bdeab73c147bd4c
parentFactorize defining system types (diff)
downloademacs-build-farm-63d9b64d5321f5a62806677be229512aacb01fed.tar.gz
Distinguish nix and guix for opening build logs
* build-farm-url.el (build-farm-build-log-url): Add 'raw' keyword argument. * build-farm-build.el (build-farm-build-view-log): Open build log in emacs or browser, and use 'guix-build-log-mode' depending on the package manager of the build farm.
-rw-r--r--build-farm-build.el21
-rw-r--r--build-farm-url.el8
2 files changed, 21 insertions, 8 deletions
diff --git a/build-farm-build.el b/build-farm-build.el
index 58ef7e3..39b0646 100644
--- a/build-farm-build.el
+++ b/build-farm-build.el
@@ -84,14 +84,25 @@ for the number of builds."
:job job
:system system)))
-(declare-function guix-build-log-find-file "guix-build-log" (file))
+(declare-function guix-build-log-mode "guix-build-log" t)
(defun build-farm-build-view-log (id &optional root-url)
"View build log of a build ID."
- (require 'guix-build-log)
- (guix-build-log-find-file
- (build-farm-build-log-url
- id :root-url (or root-url (build-farm-current-url)))))
+ (let ((pkg-manager (build-farm-url-package-manager root-url))
+ (url (or root-url (build-farm-current-url))))
+ (if (eq pkg-manager 'nix)
+ ;; Logs from hydra.nixos.org (which are actually kept on
+ ;; amazonaws) are stored in a compressed form that is not
+ ;; supported by Emacs yet: a raw log page returns
+ ;; "Content-Encoding: br" heading ("Brotli" compression). So
+ ;; instead of opening the log in Emacs (it would be displayed as
+ ;; an arbitrary binary data), open it in a browser.
+ (browse-url (build-farm-build-log-url id :root-url url))
+ (browse-url-emacs (build-farm-build-log-url
+ id :root-url url :raw t))
+ (when (and (eq pkg-manager 'guix)
+ (require 'guix-build-log nil t))
+ (guix-build-log-mode)))))
;;; Filters for processing raw entries
diff --git a/build-farm-url.el b/build-farm-url.el
index 6a5e62e..8424024 100644
--- a/build-farm-url.el
+++ b/build-farm-url.el
@@ -119,11 +119,13 @@ Skip ARG, if VALUE is nil or an empty string."
See `build-farm-url' for the meaning of ROOT-URL."
(build-farm-url root-url "build/" (number-to-string id)))
-(cl-defun build-farm-build-log-url (id &key root-url)
- "Return URL of the log file of a build ID.
+(cl-defun build-farm-build-log-url (id &key root-url raw)
+ "Return URL of the build log of a build ID.
+If RAW is non-nil, return url of the raw build log file.
See `build-farm-url' for the meaning of ROOT-URL."
(concat (build-farm-build-url id :root-url root-url)
- "/log/raw"))
+ "/log"
+ (if raw "/raw" "")))
(cl-defun build-farm-build-latest-api-url
(number &key root-url project jobset job system)