Refactor package management API

Sets out to solve a number of issues with the package management
process. Namely:

- To-be-removed packages that are simply being removed are no longer
  incorrectly labeled "quelpa->elpa", but "removed" instead.
- A backend (elpa vs quelpa) column was added to the package listing
  confirmation when running `doom update`.
- Doom now correctly recognizes that packages installed with a psuedonym
  are installed, and will not endlessly attempt to uninstall and
  reinstall them on every `doom refresh`.
- Packages declared with :built-in will no longer lose their built-in
  marking if said package is not actually present in Emacs' site load
  paths. i.e. if you say it's built in, Doom won't question it.
- package!'s :ignore property is now treated as a form whose evaluated
  result will be used as its value.
This commit is contained in:
Henrik Lissner 2019-06-11 08:01:42 +02:00
parent b3c27ebe60
commit 6641e26283
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 272 additions and 162 deletions

View file

@ -55,12 +55,12 @@
(cond ((doom-package-different-recipe-p (car pkg))
"new recipe")
((doom-package-different-backend-p (car pkg))
(if (plist-get (cdr pkg) :recipe)
"ELPA->QUELPA"
"QUELPA->ELPA"))
(format "%s -> %s"
(doom-package-backend (car pkg) 'noerror)
(doom-package-recipe-backend (car pkg) 'noerror)))
((plist-get (cdr pkg) :recipe)
"QUELPA")
("ELPA"))))
"quelpa")
("elpa"))))
(cl-sort (cl-copy-list packages) #'string-lessp
:key #'car)
"\n")))))
@ -114,8 +114,10 @@
10)))
(mapconcat
(lambda (pkg)
(format (format "+ %%-%ds %%-%ds -> %%s" (+ max-len 2) 14)
(format (format "+ %%-%ds (%%s) %%-%ds -> %%s"
(+ max-len 2) 14)
(symbol-name (car pkg))
(doom-package-backend (car pkg))
(package-version-join (cadr pkg))
(package-version-join (cl-caddr pkg))))
packages
@ -152,14 +154,14 @@
(length packages)
(mapconcat
(lambda (sym)
(let ((backend (doom-package-backend sym)))
(let ((old-backend (doom-package-backend sym 'noerror))
(new-backend (doom-package-recipe-backend sym 'noerror)))
(format "+ %s (%s)" sym
(if (doom-package-different-backend-p sym)
(pcase backend
(`quelpa "QUELPA->ELPA")
(`elpa "ELPA->QUELPA")
(_ "removed"))
(upcase (symbol-name backend))))))
(cond ((null new-backend)
"removed")
((eq old-backend new-backend)
(symbol-name new-backend))
((format "%s -> %s" old-backend new-backend))))))
(sort (cl-copy-list packages) #'string-lessp)
"\n")))))
(user-error "Aborted!"))