core: inline recipe in package list

It is now possible to override the recipe in a custom layer.

For instance to override the recipe R for package P in layer L
In a private layer L' put at the end of dotspacemacs-configuration-layers
and listing P with an init function for P, L' becomes the ower of
P and the recipe R' defined in L' overrides the recipe R.
This commit is contained in:
syl20bnr 2015-08-14 15:31:22 -04:00
parent 0d6b2f301c
commit 437a819ea1
4 changed files with 11 additions and 17 deletions

View File

@ -18,16 +18,13 @@
ggtags
helm-gtags
php-auto-yasnippets
(php-extras :location recipe)
(php-extras :location (recipe :fetcher github :repo "arnested/php-extras"))
php-mode
phpcbf
phpunit
flycheck
))
(setq php-package-recipes
'((php-extras :fetcher github :repo "arnested/php-extras")))
(defun php/init-drupal-mode ()
(use-package drupal-mode
:defer t))

View File

@ -97,7 +97,9 @@
:documentation "Layers with a post-init function.")
(location :initarg :location
:initform elpa
:type (satisfies (lambda (x) (member x '(local elpa recipe))))
:type (satisfies (lambda (x)
(or (member x '(local elpa))
(and (listp x) (eq 'recipe (car x))))))
:documentation "Location of the package.")
(step :initarg :step
:initform nil
@ -567,7 +569,7 @@ LAYERS is a list of layer symbols."
(cond
((eq 'elpa location)
(configuration-layer//install-from-elpa pkg))
((eq 'recipe location)
((and (listp location) (eq 'recipe (car location)))
(configuration-layer//install-from-recipe pkg))
(t (spacemacs-buffer/warning
"Unknown location %S for package %S." location pkg-name)))
@ -596,9 +598,7 @@ LAYERS is a list of layer symbols."
"Install PKG from a recipe."
(let* ((pgk-name (oref pkg :name))
(layer (oref pkg :owner))
(recipes-var (intern (format "%S-package-recipes" layer)))
(recipe (when (boundp recipes-var)
(assq pkg-name (symbol-value recipes-var)))))
(recipe (cons pkg-name (cdr (oref pkg :location)))))
(if recipe
(quelpa recipe)
(spacemacs-buffer/warning

View File

@ -185,7 +185,7 @@
(let* ((layer1 (cfgl-layer "layer1" :name 'layer1 :dir "/path"))
(layers (list layer1))
(layer1-packages '((pkg1 :location elpa :excluded t)
(pkg2 :location recipe)
(pkg2 :location (recipe blahblah))
(pkg3 :location local :step pre)))
(mocker-mock-default-record-cls 'mocker-stub-record))
(defun layer1/init-pkg1 nil)
@ -196,7 +196,7 @@
(:output nil :occur 1)))
(configuration-layer/layer-usedp (l) ((:output t :occur 1))))
(should (equal (list (cfgl-package "pkg3" :name 'pkg3 :owner 'layer1 :location 'local :step 'pre)
(cfgl-package "pkg2" :name 'pkg2 :owner 'layer1 :location 'recipe)
(cfgl-package "pkg2" :name 'pkg2 :owner 'layer1 :location '(recipe blahblah))
(cfgl-package "pkg1" :name 'pkg1 :owner 'layer1 :excluded t))
(configuration-layer/get-packages layers))))))
@ -204,7 +204,7 @@
(let* ((layer1 (cfgl-layer "layer1" :name 'layer1 :dir "/path"))
(layers (list layer1))
(layer1-packages '(pkg1
(pkg2 :location recipe)
(pkg2 :location (recipe blahblah))
(pkg3 :location local :step pre)
pkg4))
(mocker-mock-default-record-cls 'mocker-stub-record))
@ -218,7 +218,7 @@
(configuration-layer/layer-usedp (l) ((:output t :occur 1))))
(should (equal (list (cfgl-package "pkg4" :name 'pkg4 :owner 'layer1)
(cfgl-package "pkg3" :name 'pkg3 :owner 'layer1 :location 'local :step 'pre)
(cfgl-package "pkg2" :name 'pkg2 :owner 'layer1 :location 'recipe)
(cfgl-package "pkg2" :name 'pkg2 :owner 'layer1 :location '(recipe blahblah))
(cfgl-package "pkg1" :name 'pkg1 :owner 'layer1))
(configuration-layer/get-packages layers))))))

View File

@ -42,7 +42,7 @@
evil-escape
evil-exchange
evil-iedit-state
(evil-indent-textobject :location recipe)
(evil-indent-textobject :location (recipe :fetcher github :repo "TheBB/evil-indent-textobject"))
evil-jumper
evil-leader
evil-lisp-state
@ -125,9 +125,6 @@
(push '(paradox :location local) spacemacs-packages)
(push 'paradox spacemacs-packages))
(setq spacemacs-package-recipes
'((evil-indent-textobject :fetcher github :repo "TheBB/evil-indent-textobject")))
;; Initialization of packages
(defun spacemacs/init-ace-link ()