bin/doom-doctor: refactor + speed up tls checks

This commit is contained in:
Henrik Lissner 2017-08-05 13:19:51 +02:00
parent b65718691f
commit 6cb14cd961
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -75,6 +75,7 @@
(defmacro error! (&rest args) `(message (color 1 (color 31 ,@args)))) (defmacro error! (&rest args) `(message (color 1 (color 31 ,@args))))
(defmacro warn! (&rest args) `(message (color 1 (color 33 ,@args)))) (defmacro warn! (&rest args) `(message (color 1 (color 33 ,@args))))
(defmacro success! (&rest args) `(message (color 1 (color 32 ,@args)))) (defmacro success! (&rest args) `(message (color 1 (color 32 ,@args))))
(defmacro log! (&rest args) `(if doom-debug-mode (message (color 34 ,@args))))
(defmacro explain! (&rest args) `(message (indented 2 (autofill ,@args)))) (defmacro explain! (&rest args) `(message (indented 2 (autofill ,@args))))
;;; Polyfills ;;; Polyfills
@ -119,6 +120,7 @@
;; --- is emacs set up properly? ------------------------------ ;; --- is emacs set up properly? ------------------------------
(log! "test-emacs")
(check! (version< emacs-version "25.1") (check! (version< emacs-version "25.1")
(error! "Important: Emacs %s detected [%s]" emacs-version (executable-find "emacs")) (error! "Important: Emacs %s detected [%s]" emacs-version (executable-find "emacs"))
(explain! (explain!
@ -130,6 +132,12 @@
;; --- is the environment set up properly? -------------------- ;; --- is the environment set up properly? --------------------
;; windows? windows
(log! "test-windows")
(check! (memq system-type '(windows-nt ms-dos cygwin))
(warn! "Warning: Windows detected")
(explain! "DOOM was designed for MacOS and Linux. Expect a bumpy ride!"))
;; are all default fonts present ;; are all default fonts present
(log! "test-fonts") (log! "test-fonts")
(if (not (fboundp 'find-font)) (if (not (fboundp 'find-font))
@ -165,6 +173,7 @@
"case, ignore this warning.")))))) "case, ignore this warning."))))))
;; gnutls-cli & openssl ;; gnutls-cli & openssl
(log! "test-gnutls")
(cond ((executable-find "gnutls-cli")) (cond ((executable-find "gnutls-cli"))
((executable-find "openssl") ((executable-find "openssl")
(let* ((output (shell-command-to-string "openssl ciphers -v")) (let* ((output (shell-command-to-string "openssl ciphers -v"))
@ -200,12 +209,13 @@
"network, provider, government, neckbearded mother-in-laws, geeky roommates, " "network, provider, government, neckbearded mother-in-laws, geeky roommates, "
"or just about anyone who knows more about computers than you do!")))) "or just about anyone who knows more about computers than you do!"))))
(log! "test-tls")
(cond ((or (executable-find "gnutls-cli") (cond ((or (executable-find "gnutls-cli")
(executable-find "openssl")) (executable-find "openssl"))
(let ((tls-checktrust t) (let ((tls-checktrust t)
(gnutls-verify-error t)) (gnutls-verify-error t))
(dolist (url '("https://elpa.gnu.org/packages/archive-contents" (dolist (url '("https://elpa.gnu.org"
"https://melpa.org/packages/archive-contents")) "https://melpa.org"))
(condition-case-unless-debug ex (condition-case-unless-debug ex
(let (result) (let (result)
(let ((inhibit-message t)) (let ((inhibit-message t))
@ -240,12 +250,8 @@
(t (t
(error! "Nope!"))) (error! "Nope!")))
;; windows? windows
(check! (memq system-type '(windows-nt ms-dos cygwin))
(warn! "Warning: Windows detected")
(explain! "DOOM was designed for MacOS and Linux. Expect a bumpy ride!"))
;; bsd vs gnu tar ;; bsd vs gnu tar
(log! "test-tar")
(let ((tar-bin (or (executable-find "gtar") (let ((tar-bin (or (executable-find "gtar")
(executable-find "tar")))) (executable-find "tar"))))
(if tar-bin (if tar-bin