From 8849e9c8078bab546c3b0e913e1b81a13d47145a Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Tue, 23 Feb 2016 12:55:02 -0500 Subject: [PATCH] core: fix activation of package dependencies Bug lurking in the code for quite some time, if both a package and its dependencies were uninstalled then activation of the dependencies could fail. This is resolved by explicitly asking package.el to install the dependencies if required. --- core/core-configuration-layer.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index dc3cb2ffe..ca4477d74 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -988,7 +988,9 @@ Returns non-nil if the packages have been installed." (dolist (dep (configuration-layer//get-package-deps-from-archive pkg-name)) - (configuration-layer//activate-package (car dep))) + (if (package-installed-p (car dep)) + (configuration-layer//activate-package (car dep)) + (package-install (car dep)))) (package-install pkg-name))) (defun configuration-layer//install-from-recipe (pkg) @@ -1111,17 +1113,18 @@ Returns non-nil if the packages have been installed." (symbol-name (oref pkg :name)))) load-path)) ((eq 'local location) - (let* ((owner (object-assoc (oref pkg :owner) :name configuration-layer--layers)) + (let* ((owner (object-assoc (oref pkg :owner) + :name configuration-layer--layers)) (dir (when owner (oref owner :dir)))) (push (format "%slocal/%S/" dir pkg-name) load-path))))) ;; configuration + (unless (memq (oref pkg :location) '(local site built-in)) + (configuration-layer//activate-package pkg-name)) (cond ((eq 'dotfile (oref pkg :owner)) - (configuration-layer//activate-package pkg-name) (spacemacs-buffer/message (format "%S is configured in the dotfile." pkg-name))) (t - (configuration-layer//activate-package pkg-name) (configuration-layer//configure-package pkg)))))))) (defun configuration-layer//configure-package (pkg) @@ -1344,7 +1347,8 @@ to select one." (if (version< emacs-version "24.3.50") ;; fake version list to always activate the package (package-activate pkg '(0 0 0 0)) - (package-activate pkg))) + (unless (memq pkg package-activated-list) + (package-activate pkg)))) (defun configuration-layer/get-layers-list () "Return a list of all discovered layer symbols."