Skip to content

Commit

Permalink
Prevent :exordium-force-elpa from clobbering already installed package
Browse files Browse the repository at this point in the history
When a package has already been installed (as indicated by presence in
`package-alist`), there should be no attempt to install it again. While it is
technically possible to have multiple versions of the same package installed
side by side this deviates from the existing workflow where only one version of
the package has been installed at any given time (at least when following
standard `package-upgrade`).
  • Loading branch information
pkryger committed Dec 12, 2024
1 parent c29b31c commit b3b5de3
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions modules/init-force-elpa.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,25 @@
(package-read-all-archive-contents)
(when-let* (((package-built-in-p package))
(builtin-version (alist-get package package--builtin-versions))
(find-archive-desc
(lambda ()
(cl-find-if (lambda (desc)
(equal (package-desc-archive desc)
,archive))
(alist-get package
package-archive-contents))))
(pkg-desc (or
(cl-find-if (lambda (desc)
(equal (package-desc-archive desc)
,archive))
(alist-get package
package-archive-contents))
(funcall find-archive-desc)
(progn
(package-refresh-contents)
(cl-find-if (lambda (desc)
(equal (package-desc-archive desc)
,archive))
(alist-get package
package-archive-contents)))))
(funcall find-archive-desc))))
(archive-version (package-desc-version pkg-desc))
;; package has been previously installed, either not a
;; built-in package or a built-in package has been shadowed by
;; installation
((not (assq package package-alist)))
;; package with archive-version that is higher than the
;; built-in one
((not (package-installed-p package archive-version)))
((version-list-< builtin-version archive-version)))
(package--save-selected-packages (cons package
Expand Down

0 comments on commit b3b5de3

Please sign in to comment.