parent
3419247ee8
commit
69b5f83d5a
|
@ -1347,6 +1347,16 @@ wether the declared layer is an used one or not."
|
|||
(and obj (cfgl-package-get-safe-owner obj)
|
||||
(not (oref obj :excluded)))))
|
||||
|
||||
(defun configuration-layer//package-deps-used-p (pkg)
|
||||
"Returns non-nil if all dependencies of PKG are used."
|
||||
(not (memq nil (mapcar
|
||||
(lambda (dep-pkg)
|
||||
(let ((pkg-obj (configuration-layer/get-package dep-pkg)))
|
||||
(and pkg-obj
|
||||
(cfgl-package-get-safe-owner pkg-obj)
|
||||
(not (oref pkg-obj :excluded)))))
|
||||
(oref pkg :depends)))))
|
||||
|
||||
(defun configuration-layer/package-lazy-installp (name)
|
||||
"Return non-nil if NAME is the name of a package to be lazily installed."
|
||||
(let ((obj (configuration-layer/get-package name)))
|
||||
|
@ -1649,6 +1659,8 @@ wether the declared layer is an used one or not."
|
|||
((null (oref pkg :owners))
|
||||
(spacemacs-buffer/message
|
||||
(format "%S ignored since it has no owner layer." pkg-name)))
|
||||
((not (configuration-layer//package-deps-used-p pkg))
|
||||
(spacemacs-buffer/message (format "%S is ignored since it has dependencies that are not used." pkg-name)))
|
||||
((not (cfgl-package-enabled-p pkg))
|
||||
(spacemacs-buffer/message (format "%S is disabled." pkg-name)))
|
||||
(t
|
||||
|
|
|
@ -375,6 +375,44 @@
|
|||
(configuration-layer//add-package pkg-b)
|
||||
(should (null (configuration-layer//package-enabled-p pkg-a 'layer)))))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; configuration-layer//package-deps-used-p
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(ert-deftest test-package-deps-used-p--no-deps ()
|
||||
(let ((pkg-a (cfgl-package "pkg-a"
|
||||
:name 'pkg-a)))
|
||||
(should (configuration-layer//package-deps-used-p pkg-a))))
|
||||
|
||||
(ert-deftest test-package-deps-used-p--deps ()
|
||||
(let ((pkg-a (cfgl-package "pkg-a"
|
||||
:name 'pkg-a
|
||||
:depends '(pkg-b)))
|
||||
(pkg-b (cfgl-package "pkg-b"
|
||||
:name 'pkg-b
|
||||
:owners '(owner)))
|
||||
(owner (cfgl-layer "owner" :name 'owner))
|
||||
configuration-layer--used-layers
|
||||
(configuration-layer--indexed-packages (make-hash-table :size 2048))
|
||||
(configuration-layer--indexed-layers (make-hash-table :size 1024)))
|
||||
(configuration-layer//add-package pkg-b)
|
||||
(configuration-layer//add-layer owner 'used)
|
||||
(should (configuration-layer//package-deps-used-p pkg-a))))
|
||||
|
||||
(ert-deftest test-package-deps-used-p--depends-not-owner ()
|
||||
(let ((pkg-a (cfgl-package "pkg-a"
|
||||
:name 'pkg-a
|
||||
:depends '(pkg-b)
|
||||
:owners '(owner)))
|
||||
(pkg-b (cfgl-package "pkg-b"
|
||||
:name 'pkg-b))
|
||||
(owner (cfgl-layer "owner" :name 'owner))
|
||||
(configuration-layer--indexed-packages (make-hash-table :size 2048))
|
||||
(configuration-layer--indexed-layers (make-hash-table :size 1024)))
|
||||
(configuration-layer//add-package pkg-b)
|
||||
(configuration-layer//add-layer owner nil)
|
||||
(should (null (configuration-layer//package-deps-used-p pkg-a)))))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; configuration-layer//package-archive-absolute-pathp
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue