diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/package.el | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 15dba461d2d..f22221f3dee 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -210,6 +210,8 @@ If VERSION is nil, the package is not loaded (it is \"disabled\")." (declare-function lm-header "lisp-mnt" (header)) (declare-function lm-commentary "lisp-mnt" (&optional file)) (defvar url-http-end-of-headers) +(declare-function url-recreate-url "url" (urlobj)) +(defvar url-http-target-url) (defcustom package-archives '(("gnu" . "http://elpa.gnu.org/packages/")) "An alist of archives from which to fetch. @@ -789,7 +791,8 @@ It will move point to somewhere in the headers." (require 'url-http) (let ((response (url-http-parse-response))) (when (or (< response 200) (>= response 300)) - (error "Error during download request:%s" + (error "Error downloading %s:%s" + (url-recreate-url url-http-target-url) (buffer-substring-no-properties (point) (line-end-position)))))) (defun package--archive-file-exists-p (location file) @@ -815,30 +818,26 @@ It will move point to somewhere in the headers." (defun package--check-signature (location file) "Check signature of the current buffer. GnuPG keyring is located under \"gnupg\" in `package-user-dir'." - (let ((context (epg-make-context 'OpenPGP)) - (homedir (expand-file-name "gnupg" package-user-dir)) - (sig-file (concat file ".sig")) - sig-content - good-signatures) - (condition-case-unless-debug error - (setq sig-content (package--with-work-buffer location sig-file - (buffer-string))) - (error "Failed to download %s: %S" sig-file (cdr error))) + (let* ((context (epg-make-context 'OpenPGP)) + (homedir (expand-file-name "gnupg" package-user-dir)) + (sig-file (concat file ".sig")) + (sig-content (package--with-work-buffer location sig-file + (buffer-string)))) (epg-context-set-home-directory context homedir) (epg-verify-string context sig-content (buffer-string)) ;; The .sig file may contain multiple signatures. Success if one ;; of the signatures is good. - (setq good-signatures - (delq nil (mapcar (lambda (sig) - (if (eq (epg-signature-status sig) 'good) - sig)) - (epg-context-result-for context 'verify)))) - (if (null good-signatures) - (error "Failed to verify signature %s: %S" - sig-file - (mapcar #'epg-signature-to-string - (epg-context-result-for context 'verify))) - good-signatures))) + (let ((good-signatures + (delq nil (mapcar (lambda (sig) + (if (eq (epg-signature-status sig) 'good) + sig)) + (epg-context-result-for context 'verify))))) + (if (null good-signatures) + (error "Failed to verify signature %s: %S" + sig-file + (mapcar #'epg-signature-to-string + (epg-context-result-for context 'verify))) + good-signatures)))) (defun package-install-from-archive (pkg-desc) "Download and install a tar package." @@ -880,13 +879,13 @@ GnuPG keyring is located under \"gnupg\" in `package-user-dir'." "Return true if PACKAGE, of MIN-VERSION or newer, is installed. MIN-VERSION should be a version list." (unless package--initialized (error "package.el is not yet initialized!")) - (or - (let ((pkg-descs (cdr (assq package package-alist)))) - (and pkg-descs - (version-list-<= min-version - (package-desc-version (car pkg-descs))))) - ;; Also check built-in packages. - (package-built-in-p package min-version))) + (or + (let ((pkg-descs (cdr (assq package package-alist)))) + (and pkg-descs + (version-list-<= min-version + (package-desc-version (car pkg-descs))))) + ;; Also check built-in packages. + (package-built-in-p package min-version))) (defun package-compute-transaction (packages requirements) "Return a list of packages to be installed, including PACKAGES. @@ -1230,8 +1229,11 @@ The file can either be a tar file or an Emacs Lisp file." (if (file-exists-p signed-file) (delete-file signed-file))) ;; Update package-alist. - (let* ((name (package-desc-name pkg-desc))) - (delete (delete pkg-desc (assq name package-alist)) package-alist)) + (let* ((name (package-desc-name pkg-desc)) + (pkgs (assq name package-alist))) + (delete pkg-desc pkgs) + (unless (cdr pkgs) + (setq package-alist (delq pkgs package-alist)))) (message "Package `%s' deleted." (package-desc-full-name pkg-desc))))) (defun package-archive-base (desc) |