[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive bbdefc9816 158/163: Refactor: (h/install)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive bbdefc9816 158/163: Refactor: (h/install) |
Date: |
Fri, 31 May 2024 04:00:42 -0400 (EDT) |
branch: elpa/hyperdrive
commit bbdefc98160fcb872b141dd1dd5795a1cbf3a338
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Refactor: (h/install)
---
hyperdrive.el | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/hyperdrive.el b/hyperdrive.el
index 37ee04c0ca..c800e6c74a 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1315,30 +1315,36 @@ If FORCEP, don't prompt for confirmation before
downloading."
(unless (yes-or-no-p "Download and reinstall/upgrade the gateway? ")
(h/user-error "Not downloading; aborted"))))
(let ((urls-and-hashes (alist-get system-type h/gateway-urls-and-hashes))
- (destination (expand-file-name h/gateway-program h/gateway-directory)))
+ (destination (expand-file-name h/gateway-program h/gateway-directory))
+ size)
(cl-labels
((try ()
- (pcase-let* (((map :url :sha256) (pop urls-and-hashes))
- (size (or forcep (ignore-errors
- (h/message "Checking server...")
- (file-size-human-readable
- (head-size url))))))
+ (pcase-let (((map :url :sha256) (pop urls-and-hashes)))
+ (unless size
+ ;; Only successfully get size once.
+ (ignore-errors
+ (h/message "Checking server %S..."
+ (url-host (url-generic-parse-url url)))
+ (setf size (file-size-human-readable
+ (head-size url)))))
(if size
(if (or forcep
(yes-or-no-p
(format "Download and install gateway (%s)? " size)))
(progn
- (setf forcep t) ;; Don't prompt again.
+ (setf forcep t) ;; Don't prompt again.
(download url sha256))
(h/message "Installation canceled."))
;; HEAD request failed: try next URL.
+ (h/message "Server %S unresponsive. Trying next server..."
+ (url-host (url-generic-parse-url url)))
(if urls-and-hashes
(try)
(setf h/install-process nil)
(hyperdrive-menu-refresh)
(hyperdrive-error "Downloading failed; no more mirrors
available")))))
(head-size (url)
- (when-let ((response (plz 'head url :as 'response)))
+ (when-let ((response (plz 'head url :as 'response :connect-timeout
5)))
(cl-parse-integer
(alist-get 'content-length (plz-response-headers response)))))
(download (url sha256)
@@ -1358,8 +1364,8 @@ If FORCEP, don't prompt for confirmation before
downloading."
url plz-error)
(try)))
(when (file-exists-p temp-file)
- (delete-file temp-file))))))
- (h/message "Downloading gateway..."))
+ (delete-file temp-file)))))
+ (h/message "Downloading %s from %S to %S" size url destination)))
(check (file-name sha256 url)
(if (with-temp-buffer
(insert-file-contents-literally file-name)
- [nongnu] elpa/hyperdrive 6e5620f7c8 143/163: Tidy: (h//gateway-path) Use shorthands, (continued)
- [nongnu] elpa/hyperdrive 6e5620f7c8 143/163: Tidy: (h//gateway-path) Use shorthands, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 4f3263d23a 139/163: Comment: Add TODO, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 13482cbdc1 134/163: Fix: (h/check-gateway-version) Use substitute-command-keys, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 25845121cd 142/163: Fix: (h/check-gateway-version) Docstring, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 68683838c8 148/163: Tidy: Reorder defcustoms, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive db0ec58f14 145/163: Change: (h/menu-bar-menu) "Restart Gateway" binding, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 4b23c6bf50 144/163: Change: (h/check-gateway-version) Say version expected/got, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 684856884d 146/163: Tidy: (h/menu-bar-menu) Capitalize labels, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 84844d645f 149/163: Fix: (h/gateway-command-args) Run gateway on user-defined port, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 42778de4c2 154/163: Fix: (hyperdrive-hyper-gateway-port) define-obsolete-variable-alias, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive bbdefc9816 158/163: Refactor: (h/install),
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 1026092bc6 156/163: Change: (h/gateway-command-args) Add "--port" at runtime, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 3dc890cc9d 161/163: Tidy: Checkdoc, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 3f4a789f52 014/163: Docs: (CONTRIBUTING.org) Add version numbers locations section, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 024d74b64f 015/163: Meta: (.dir-locals.el) Set org-id-link-to-org-use-id nil, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 0f214f58ee 017/163: Docs: (CONTRIBUTING.org) Add links to release hashsums, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 960232a9b1 010/163: Add: (h/ensure-gateway), ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 1c15a779bd 011/163: Notes: Update, ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive a2d564f821 018/163: Add: (h/restart), ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 473013eae2 007/163: Add: Vars (h/gateway-version-expected, h/gateway-version-correct-p), ELPA Syncer, 2024/05/31
- [nongnu] elpa/hyperdrive 03650d7bad 021/163: Tidy: Error messages, ELPA Syncer, 2024/05/31