Subject: bug#59728: 30.0.50; package-vc does not handle package-quickstart

From: Matt Armstrong <[email-masked]>
Date: Wed, 30 Nov 2022 16:14:53 -0800

Philip Kaludercic <[email-masked]> writes:

> The central function here is `package-vc--unpack-1' so the following
> patch should take care of that:
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index a4520ab800..5f7674190b 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -433,7 +433,8 @@ package-vc--unpack-1
>                                (car load-path))))
>                    (current-buffer))
>             (buffer-string))
> -         nil (expand-file-name auto-name pkg-dir))))
> +         nil (expand-file-name auto-name pkg-dir)))
> +      (package-quickstart-refresh))
>  
>      ;; Generate package file
>      (package-vc--generate-description-file pkg-desc pkg-file)
>
> However I am uncertain if this is too aggressive?  I don't have the time
> to test it properly right now, but could try this (or some variation
> thereof) and tell me if it addresses the issue?

I moved the call to `package-quickstart-refresh' down, as it byte
compiles the autoloads and judging from other comments in this function,
and also discussion in bug#59707, that is best done after the new
version of the package is loaded.

Also, the two `package--quickstart-maybe-refresh' calls in package.el
are just after a `package--save-selected-packages' call, so I did the
same here.

The seems to work fine in my manual testing.  Thanks for the tip!

As for whether this is too aggressive, I'm not sure.  Seems about as
aggressive as package.el is today.

>From b74f1ac29f6427094a6beb15a6a0227f750281c3 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <[email-masked]>
Date: Wed, 30 Nov 2022 15:58:07 -0800
Subject: [PATCH 2/2] Refresh the package quickstart file in package-vc

* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Call
`package--quickstart-maybe-refresh', just as
`package-install-from-buffer' does.  (bug#59728)
---
 lisp/emacs-lisp/package-vc.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index a4520ab800..04b4c81c13 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -464,6 +464,7 @@ package-vc--unpack-1
   (package--save-selected-packages
    (cons (package-desc-name pkg-desc)
          package-selected-packages))
+  (package--quickstart-maybe-refresh)
 
   ;; Confirm that the installation was successful
   (let ((main-file (package-vc--main-file pkg-desc)))
-- 
2.35.1