(eval-when-compile (require 'subr-x))
(eval-when-compile (require 'cl-lib))
(eval-when-compile (require 'epg)) ;For setf accessors.
+(require 'seq)
(require 'tabulated-list)
(require 'macroexp)
(defvar package--downloads-in-progress nil
"List of in-progress asynchronous downloads.")
-(declare-function epg-check-configuration "epg-config"
- (config &optional minimum-version))
-(declare-function epg-configuration "epg-config" ())
+(declare-function epg-find-configuration "epg-config"
+ (protocol &optional force))
(declare-function epg-import-keys-from-file "epg" (context keys))
;;;###autoload
(let ((default-keyring (expand-file-name "package-keyring.gpg"
data-directory))
(inhibit-message async))
+ (if (get 'package-check-signature 'saved-value)
+ (when package-check-signature
+ (epg-find-configuration 'OpenPGP))
+ (setq package-check-signature
+ (if (epg-find-configuration 'OpenPGP)
+ 'allow-unsigned)))
(when (and package-check-signature (file-exists-p default-keyring))
(condition-case-unless-debug error
- (progn
- (epg-check-configuration (epg-configuration))
- (package-import-keyring default-keyring))
+ (package-import-keyring default-keyring)
(error (message "Cannot import default keyring: %S" (cdr error))))))
(package--download-and-read-archives async))
;; gets installed).
(if (not package-selected-packages)
(message "`package-selected-packages' is empty, nothing to install")
- (cl-loop for p in package-selected-packages
- unless (package-installed-p p)
- collect p into lst
- finally
- (if lst
- (when (y-or-n-p
- (format "%s packages will be installed:\n%s, proceed?"
- (length lst)
- (mapconcat #'symbol-name lst ", ")))
- (mapc #'package-install lst))
- (message "All your packages are already installed")))))
+ (let* ((not-installed (seq-remove #'package-installed-p package-selected-packages))
+ (available (seq-filter (lambda (p) (assq p package-archive-contents)) not-installed))
+ (difference (- (length not-installed) (length available))))
+ (cond
+ (available
+ (when (y-or-n-p
+ (format "%s packages will be installed:\n%s, proceed?"
+ (length available)
+ (mapconcat #'symbol-name available ", ")))
+ (mapc (lambda (p) (package-install p 'dont-select)) available)))
+ ((> difference 0)
+ (message "%s packages are not available (the rest already installed), maybe you need to `M-x package-refresh-contents'"
+ difference))
+ (t
+ (message "All your packages are already installed"))))))
\f
;;; Package Deletion