From 840b431cf6aed39c79eae0842764dfba9d4ed236 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Sun, 22 Dec 2019 08:22:20 -0800 Subject: [PATCH] configuration: fix redundant update checking Fixes #13114 --- CHANGELOG.develop | 1 + core/core-configuration-layer.el | 36 +++++++++++++++++++------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.develop b/CHANGELOG.develop index f3731a39c..473759167 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -626,6 +626,7 @@ Other: - Replaced =destructuring-bind= with =cl-destructuring-bind= (thanks to duianto) - Ignore nils in dotspacemacs-configuration-layers (thanks to Ag) + - Fixed redundant package version checking during update (thanks to aaronjensen) - Other: - New function =configuration-layer/message= to display message in =*Messages*= buffer (thanks to Sylvain Benner) diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index b0d7fccb7..9f14733b2 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -1827,27 +1827,35 @@ RNAME is the name symbol of another existing layer." "to add a recipe for it in alist %S.") pkg-name recipes-var)))) -(defun configuration-layer//filter-packages-with-deps +(defun configuration-layer//filter-packages-with-deps-recur (pkg-names filter &optional use-archive) "Return a filtered PKG-NAMES list where each elements satisfies FILTER." (when pkg-names (let (result) (dolist (pkg-name pkg-names) - ;; recursively check dependencies - (let* ((deps - (if use-archive - (configuration-layer//get-package-deps-from-archive - pkg-name) - (configuration-layer//get-package-deps-from-alist pkg-name))) - (install-deps - (when deps (configuration-layer//filter-packages-with-deps - (mapcar 'car deps) filter)))) - (when install-deps - (setq result (append install-deps result)))) - (when (funcall filter pkg-name) - (add-to-list 'result pkg-name t))) + (when (not (memq pkg-name checked-packages)) + (push pkg-name checked-packages) + ;; recursively check dependencies + (let* ((deps + (if use-archive + (configuration-layer//get-package-deps-from-archive + pkg-name) + (configuration-layer//get-package-deps-from-alist pkg-name))) + (install-deps + (when deps (configuration-layer//filter-packages-with-deps-recur + (mapcar 'car deps) filter)))) + (when install-deps + (setq result (append install-deps result)))) + (when (funcall filter pkg-name) + (add-to-list 'result pkg-name t)))) (delete-dups result)))) +(defun configuration-layer//filter-packages-with-deps + (pkg-names filter &optional use-archive) + "Return a filtered PKG-NAMES list where each elements satisfies FILTER." + (let ((checked-packages)) + (configuration-layer//filter-packages-with-deps-recur pkg-names filter use-archive))) + (defun configuration-layer//get-uninstalled-packages (pkg-names) "Return a filtered list of PKG-NAMES to install." (configuration-layer//filter-packages-with-deps