From d610a13d60d8267f98cad58214a43b9aa8a88dfe Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Mon, 11 Jan 2016 00:29:12 -0500 Subject: [PATCH] core: display the list of packages to update --- core/core-configuration-layer.el | 90 +++++++++++++++++--------------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index 50f6ec9b9..e3047fed4 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -947,8 +947,7 @@ path." If called with a prefix argument ALWAYS-UPDATE, assume yes to update." (interactive "P") (spacemacs-buffer/insert-page-break) - (spacemacs-buffer/append (concat "\nUpdating Emacs packages from remote " - "repositories (ELPA, MELPA, etc.)...\n")) + (spacemacs-buffer/append "\nUpdating package archives, please wait...\n") (configuration-layer/retrieve-package-archives nil 'force) (setq configuration-layer--skipped-packages nil) (let* ((update-packages @@ -972,48 +971,53 @@ If called with a prefix argument ALWAYS-UPDATE, assume yes to update." configuration-layer--skipped-packages " ")))) ;; (message "packages to udpate: %s" update-packages) - (if (> upgrade-count 0) - (if (and (not always-update) - (not (yes-or-no-p (format (concat "%s package(s) to update, " - (if (> skipped-count 0) - (format "%s package(s) skipped, " - skipped-count) - "") - "do you want to continue ? ") - upgrade-count)))) - (spacemacs-buffer/append - "Packages update has been cancelled.\n") - ;; backup the package directory and construct an alist - ;; variable to be cached for easy update and rollback - (spacemacs-buffer/append - "--> performing backup of package(s) to update...\n" t) + (when (> upgrade-count 0) + (spacemacs-buffer/append + (format (concat "--> Found %s package(s) to update" + (if (> skipped-count 0) + (format " (skipped %s):\n" skipped-count) + ":\n")) + upgrade-count) t) + (mapc (lambda (x) + (spacemacs-buffer/append (format "%s\n" x) t)) + update-packages) + (if (and (not always-update) + (not (yes-or-no-p + (format "Do you want to update %s package(s) ? " + upgrade-count)))) + (spacemacs-buffer/append "Packages update has been cancelled.\n" t) + ;; backup the package directory and construct an alist + ;; variable to be cached for easy update and rollback + (spacemacs-buffer/append + "--> performing backup of package(s) to update...\n" t) + (spacemacs//redisplay) + (dolist (pkg update-packages) + (let* ((src-dir (configuration-layer//get-package-directory pkg)) + (dest-dir (expand-file-name + (concat rollback-dir + (file-name-as-directory + (file-name-nondirectory src-dir)))))) + (copy-directory src-dir dest-dir 'keeptime 'create 'copy-content) + (push (cons pkg (file-name-nondirectory src-dir)) + update-packages-alist))) + (spacemacs/dump-vars-to-file + '(update-packages-alist) + (expand-file-name (concat rollback-dir + configuration-layer-rollback-info))) + (dolist (pkg update-packages) + (setq upgraded-count (1+ upgraded-count)) + (spacemacs-buffer/replace-last-line + (format "--> preparing update of package %s... [%s/%s]" + pkg upgraded-count upgrade-count) t) (spacemacs//redisplay) - (dolist (pkg update-packages) - (let* ((src-dir (configuration-layer//get-package-directory pkg)) - (dest-dir (expand-file-name - (concat rollback-dir - (file-name-as-directory - (file-name-nondirectory src-dir)))))) - (copy-directory src-dir dest-dir 'keeptime 'create 'copy-content) - (push (cons pkg (file-name-nondirectory src-dir)) - update-packages-alist))) - (spacemacs/dump-vars-to-file - '(update-packages-alist) - (expand-file-name (concat rollback-dir - configuration-layer-rollback-info))) - (dolist (pkg update-packages) - (setq upgraded-count (1+ upgraded-count)) - (spacemacs-buffer/replace-last-line - (format "--> preparing update of package %s... [%s/%s]" - pkg upgraded-count upgrade-count) t) - (spacemacs//redisplay) - (configuration-layer//package-delete pkg)) - (spacemacs-buffer/append - (format "\n--> %s package(s) to be updated.\n" upgraded-count)) - (spacemacs-buffer/append - "\nEmacs has to be restarted to actually install the new packages.\n") - (configuration-layer//cleanup-rollback-directory) - (spacemacs//redisplay)) + (configuration-layer//package-delete pkg)) + (spacemacs-buffer/append + (format "\n--> %s package(s) to be updated.\n" upgraded-count)) + (spacemacs-buffer/append + "\nEmacs has to be restarted to actually install the new packages.\n") + (configuration-layer//cleanup-rollback-directory) + (spacemacs//redisplay))) + (when (eq upgrade-count 0) (spacemacs-buffer/append "--> All packages are up to date.\n") (spacemacs//redisplay))))