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.
This commit is contained in:
syl20bnr 2016-02-23 12:55:02 -05:00
parent 8ac2cd1c6f
commit 8849e9c807
1 changed files with 9 additions and 5 deletions

View File

@ -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."