[core] new recipe :fetcher local

with this curent (package :location local) can be replaced with (package
:location (recipe :fetcher local)) then quelpa will install local pacakge. We
have the benefit of bytecompile and autoload

[packages] use new fetcher for local
This commit is contained in:
Thanh Vuong 2022-03-25 23:21:01 -06:00 committed by Maxi Wolff
parent 96360701cc
commit b8f471dc1c
No known key found for this signature in database
GPG Key ID: 2DD07025BFDBD89A
9 changed files with 35 additions and 13 deletions

View File

@ -454,6 +454,22 @@ cache folder.")
quelpa-update-melpa-p nil)
(require 'quelpa))
(defun configuration-layer//make-quelpa-recipe (pkg)
"Read recipe in PKG if :fetcher is local, then turn it to a correct file recepe.
Otherwise return the recipe unchanged. PKG is of `cfgl-package' type."
(let* ((config (cdr (oref pkg :location)))
(fetcher (plist-get config :fetcher))
(pkg-name (oref pkg :name)))
(cond
((eq fetcher 'local)
`(,pkg-name
:fetcher file
:path ,(configuration-layer/get-location-directory
(oref pkg :name)
(oref pkg :location)
(car (oref pkg :owners)))))
(t (cons pkg-name (cdr (oref pkg :location)))))))
(defun configuration-layer//package-archive-absolute-path-p (archive)
"Return t if ARCHIVE has an absolute path defined."
(let ((path (cdr archive)))
@ -1789,7 +1805,7 @@ RNAME is the name symbol of another existing layer."
(window-height . 0.2)))))
;; ensure we have quelpa available first
(configuration-layer//configure-quelpa)
(let* ((upkg-names (configuration-layer//get-uninstalled-packages packages))
(let* ((upkg-names (configuration-layer//get-to-install-packages packages))
(not-inst-count (length upkg-names))
installed-count)
;; installation
@ -1844,7 +1860,7 @@ RNAME is the name symbol of another existing layer."
(layer (car (oref pkg :owners)))
(recipe (cons pkg-name (cdr (oref pkg :location)))))
(if recipe
(quelpa recipe)
(quelpa (configuration-layer//make-quelpa-recipe pkg))
(configuration-layer//warning
(concat "Cannot find any recipe for package %S! Be sure "
"to add a recipe for it in alist %S.")
@ -1881,7 +1897,7 @@ RNAME is the name symbol of another existing layer."
(configuration-layer//filter-packages-with-deps-recur
checked-packages pkg-names filter use-archive)))
(defun configuration-layer//get-uninstalled-packages (pkg-names)
(defun configuration-layer//get-to-install-packages (pkg-names)
"Return a filtered list of PKG-NAMES to install."
(configuration-layer//filter-packages-with-deps
pkg-names (lambda (x)
@ -1907,13 +1923,16 @@ RNAME is the name symbol of another existing layer."
(defun configuration-layer//new-version-available-p (pkg-name)
"Return non nil if there is a new version available for PKG-NAME."
(let ((recipe (configuration-layer//get-package-recipe pkg-name))
(pkg (configuration-layer/get-package pkg-name))
(cur-version (configuration-layer//get-package-version-string pkg-name))
(quelpa-upgrade-p t)
new-version)
(when cur-version
(setq new-version
(if recipe
(or (quelpa-checkout recipe (expand-file-name (symbol-name pkg-name) quelpa-build-dir)) cur-version)
(or (quelpa-checkout (configuration-layer//make-quelpa-recipe pkg)
(expand-file-name (symbol-name pkg-name) quelpa-build-dir))
cur-version)
(configuration-layer//get-latest-package-version-string
pkg-name)))
;; (message "%s: %s > %s ?" pkg-name cur-version new-version)

View File

@ -24,7 +24,9 @@
'(auto-highlight-symbol
imenu
marginalia
(compleseus-spacemacs-help :location local)
;; (compleseus-spacemacs-help :location local)
(compleseus-spacemacs-help
:location (recipe :fetcher local))
consult
consult-yasnippet
embark
@ -407,6 +409,7 @@
(defun compleseus/init-compleseus-spacemacs-help ()
(use-package compleseus-spacemacs-help
:defer t
:init
(spacemacs/set-leader-keys
"h ." 'compleseus-spacemacs-help-dotspacemacs

View File

@ -36,9 +36,9 @@
;; pre packages, initialized after the bootstrap packages
;; these packages can use use-package
(dotenv-mode :step pre)
(evil-evilified-state :location local :step pre :protected t)
(evil-evilified-state :location (recipe :fetcher local) :step pre :protected t)
(pcre2el :step pre)
(holy-mode :location local :step pre)
(holy-mode :location (recipe :fetcher local) :step pre)
(hybrid-mode :location (recipe :fetcher local) :step pre)
(spacemacs-theme :location built-in)
dash))

View File

@ -47,7 +47,7 @@
py-isort
pydoc
pyenv-mode
(pylookup :location local)
(pylookup :location (recipe :fetcher local))
pytest
(python :location built-in)
pyvenv

View File

@ -38,7 +38,7 @@
(electric-indent-mode :location built-in)
(ediff :location built-in)
(eldoc :location built-in)
(help-fns+ :location local)
(help-fns+ :location (recipe :fetcher local))
(hi-lock :location built-in)
(image-mode :location built-in)
(imenu :location built-in)

View File

@ -40,7 +40,7 @@
pcre2el
(smartparens :toggle dotspacemacs-activate-smartparens-mode)
(evil-swap-keys :toggle dotspacemacs-swap-number-row)
(spacemacs-whitespace-cleanup :location local)
(spacemacs-whitespace-cleanup :location (recipe :fetcher local))
string-edit
string-inflection
multi-line

View File

@ -37,7 +37,7 @@
spaceline
spaceline-all-the-icons
symon
(vim-powerline :location local)))
(vim-powerline :location (recipe :fetcher local))))
(defun spacemacs-modeline/post-init-anzu ()
(when (eq 'all-the-icons (spacemacs/get-mode-line-theme-name))

View File

@ -34,7 +34,7 @@
;; `org' package.
(default-org-config :location built-in)
org-superstar
(space-doc :location local)
(space-doc :location (recipe :fetcher local))
toc-org
))

View File

@ -27,7 +27,7 @@
(ivy-purpose :requires ivy)
popwin
(spacemacs-purpose-popwin
:location local
:location (recipe :fetcher local)
:requires popwin)
window-purpose))