emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-30 3d8e49c41a6: Attempt to install package first when upgrading


From: Philip Kaludercic
Subject: emacs-30 3d8e49c41a6: Attempt to install package first when upgrading
Date: Sat, 7 Dec 2024 15:46:45 -0500 (EST)

branch: emacs-30
commit 3d8e49c41a66a7f05cb96f84e2a10f0f308ac9ca
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    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)
---
 lisp/emacs-lisp/package.el | 10 +++++++---
 1 file 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]