Fix "err=[-50]" gnutls error

When updating/installing packages.
This commit is contained in:
Henrik Lissner 2019-07-20 11:05:52 +02:00
parent ba71d95066
commit 8b27d19e0b
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -19,28 +19,6 @@
(setq doom--refreshed-p nil)
(doom-cache-set 'last-pkg-refresh nil))
(defun doom--refresh-pkg-contents ()
(unless (file-exists-p package-user-dir)
(make-directory package-user-dir t))
(require 'gnutls)
(let ((old-gnutls-algorithm-priority gnutls-algorithm-priority))
;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3434
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(unwind-protect
(progn
(let ((default-keyring (expand-file-name "package-keyring.gpg"
data-directory)))
(when (and package-check-signature (file-exists-p default-keyring))
(condition-case-unless-debug error
(package-import-keyring default-keyring)
(error (message "Cannot import default keyring: %S" (cdr error))))))
(dolist (archive package-archives)
(cl-pushnew archive package--downloads-in-progress
:test #'equal))
(dolist (archive package-archives)
(package--download-one-archive archive "archive-contents" nil)))
(setq gnutls-algorithm-priority old-gnutls-algorithm-priority))))
;;;###autoload
(defun doom-refresh-packages-maybe (&optional force-p)
"Refresh ELPA packages, if it hasn't been refreshed recently."
@ -51,12 +29,11 @@
(condition-case e
(progn
(message "Refreshing package archives")
(doom--refresh-pkg-contents)
(package-refresh-contents)
(doom-cache-set 'last-pkg-refresh t 1200))
((debug error)
(message "Trying again %s" e)
(doom--refresh-pkg-contents)
(signal 'doom-error e)))))
((debug error)
(doom--refresh-pkg-cache)
(signal 'doom-error e)))))
;;