summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2024-12-07 20:02:00 +0100
committerPhilip Kaludercic <philipk@posteo.net>2024-12-07 20:02:58 +0100
commit3d8e49c41a66a7f05cb96f84e2a10f0f308ac9ca (patch)
treeff73ffff4c301fbfafb6b8e3477708c113475d7b /lisp/emacs-lisp
parent4f2a21cc2a369341b91bb3657e851bdc75e5e053 (diff)
downloademacs-3d8e49c41a66a7f05cb96f84e2a10f0f308ac9ca.tar.gz
emacs-3d8e49c41a66a7f05cb96f84e2a10f0f308ac9ca.tar.bz2
emacs-3d8e49c41a66a7f05cb96f84e2a10f0f308ac9ca.zip
Attempt to install package first when upgrading
* lisp/emacs-lisp/package.el (package-upgrade): Swap the 'package-install' and the 'package-delete' invocations. (Bug#74556)
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 53d04b0d5ec..33d74cc7663 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2272,12 +2272,16 @@ had been enabled."
;; `pkg-desc' will be nil when the package is an "active built-in".
(if (and pkg-desc (package-vc-p pkg-desc))
(package-vc-upgrade pkg-desc)
- (when pkg-desc
- (package-delete pkg-desc 'force 'dont-unselect))
(package-install package
;; An active built-in has never been "selected"
;; before. Mark it as installed explicitly.
- (and pkg-desc 'dont-select)))))
+ (and pkg-desc 'dont-select))
+ ;; We delete the old package via the descriptor after installing
+ ;; the new package to avoid losing the package if there issues
+ ;; during installation (Bug#74556).
+ (when pkg-desc
+ (cl-assert (package-desc-dir pkg-desc))
+ (package-delete pkg-desc 'force 'dont-unselect)))))
(defun package--upgradeable-packages (&optional include-builtins)
;; Initialize the package system to get the list of package