From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#62720: 29.0.60; Not easy at all to upgrade :core packages like Eglot Date: Mon, 10 Apr 2023 17:01:31 +0100 Message-ID: References: <87a5zj2vfo.fsf@gmail.com> <87wn2modrm.fsf@posteo.net> <87ile6o2ov.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6210"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Philip Kaludercic , 62720@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 10 18:02:18 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pltyD-0001Le-Un for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Apr 2023 18:02:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plty6-0002SN-Vx; Mon, 10 Apr 2023 12:02:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pltxy-0002Ek-Ou for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2023 12:02:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pltxy-0006O2-HF for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2023 12:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pltxy-0000Qc-0I for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2023 12:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Apr 2023 16:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62720 X-GNU-PR-Package: emacs Original-Received: via spool by 62720-submit@debbugs.gnu.org id=B62720.16811425101621 (code B ref 62720); Mon, 10 Apr 2023 16:02:01 +0000 Original-Received: (at 62720) by debbugs.gnu.org; 10 Apr 2023 16:01:50 +0000 Original-Received: from localhost ([127.0.0.1]:35783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pltxm-0000Q5-02 for submit@debbugs.gnu.org; Mon, 10 Apr 2023 12:01:50 -0400 Original-Received: from mail-oo1-f48.google.com ([209.85.161.48]:37721) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pltxk-0000Ps-5a for 62720@debbugs.gnu.org; Mon, 10 Apr 2023 12:01:48 -0400 Original-Received: by mail-oo1-f48.google.com with SMTP id r1-20020a4acb01000000b00541c8b2a4b4so485373ooq.4 for <62720@debbugs.gnu.org>; Mon, 10 Apr 2023 09:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681142502; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=p622tmW70/OfFiPOPNZru2jF8gKg+u2fUwU4UIrsfw8=; b=nVAumEbmhQqZaoWpiDwHxrd+A+ikVLqaAfeF1lP3j9CsY9oNxaEICDIE9J0AvV5FQW 4b86gRj5dyQ2Hyuqz1/vXd5tyCh1JQu4MljNg+EpiJ22vc1/oLm8f+KQoxVatkUHrov7 9IfDFolYkbAuhP8BoXEZHZKQMdnoZCefwvk7/0VXPh8y5/pLOoLSQH7qapQKYgyHmKbe rdLoxeCkK2WNCcvmpW3o+IQBTpfV/8h0m5YRcNACrOPWvk/OQyDyHgakttFGtYEpZaUs uRgNVX1w3GMpdTKy8nq4ii1yamrErECpFr1CHS/wXvtlskQBcYTVyypzn91xCck7qQKG VMMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681142502; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p622tmW70/OfFiPOPNZru2jF8gKg+u2fUwU4UIrsfw8=; b=6Qn70mQo6d74TdgVzQsSmImNepQcbl0G7jQUfU/y5UsJG+2fsFTCALNF22pxG7j4NT E/ODQV+lIVbvQvfe6sME51WAvhZZs0V9UK9vhF3Yhvg6BzFlbOOv0vtVEwbk3TlVUPDs VX8at4SqxKaWp3spODvvu1bMr+CSUnYo3eN1fSFgByvnfM+/ErGBZ2I3T+8N0LPDlGCC aPvQVbF0hRv4nptf5T0YROvRfQuK6aiymyF1l4/XeYziLaj4JK9klquHiD9TzU5fjHK6 JH8hYXtRLMDU9Udz2UU9dt3Ql/LvK9LskhWcflvvkqFGMHK2AAg0x2CMW9kP52Vq3Znq XR/A== X-Gm-Message-State: AAQBX9e5Vp6oq0DP31I0XbFSTs2Cbnftodi1xqm0LbZaouEi795or7mz /jf4HPfwM+cC1vkJXga3prxRCXwCe0rp29KqGb0= X-Google-Smtp-Source: AKy350ZoE6aHRN31OOnrvCBGfSf9iJdpMBHVWJZp7G6nTsB1Yl9n60cxLY/bwVyg2IUjrAjUTGpyYxZLa37wg8oxwVI= X-Received: by 2002:a4a:d186:0:b0:52e:17e2:7d4c with SMTP id j6-20020a4ad186000000b0052e17e27d4cmr2399281oor.1.1681142502164; Mon, 10 Apr 2023 09:01:42 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259588 Archived-At: On Sat, Apr 8, 2023 at 4:45=E2=80=AFPM Stefan Monnier wrote: > > > As package-update just defers to package-install, I don't find this > > surprising. What you want is that package.el always treats a built-in > > package as upgradable to a package from ELPA. It seems like this shoul= d > > be possible by adjusting the interactive spec of package-install and > > modifying package-compute-transaction or even package-built-in-p. > > I agree, tho I don't understand why you say "built-in" above. Isn't the > problem also present for already-installed-but-out-of-date ELPA packages? I bit the bullet and went after this in package.el. The answer is no, it's not present for those packages. But Philip's imagined fix seems to be more complicated than it needs to be. Here's a simple patch that works well in my tests. It makes M-x package-update also update built-in-packages. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index f92afe56b76..f54b6f39e40 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2243,11 +2243,16 @@ package-update (let* ((package (if (symbolp name) name (intern name))) - (pkg-desc (cadr (assq package package-alist)))) - (if (package-vc-p pkg-desc) - (package-vc-update pkg-desc) - (package-delete pkg-desc 'force) - (package-install package 'dont-select)))) + (nonbuiltin (assq package package-alist))) + (cond (nonbuiltin + (let ((desc (cadr nonbuiltin))) + (if (package-vc-p desc) + (package-vc-update desc) + (package-delete desc 'force) + (package-install package 'dont-select)))) + (t + (package-install + (cadr (assq package package-archive-contents))))))) (defun package--updateable-packages () ;; Initialize the package system to get the list of package @@ -2261,10 +2266,14 @@ package--updateable-packages (assq (car elt) package-archive-contents))) (and available (version-list-< - (package-desc-version (cadr elt)) + (if (vectorp (cdr elt)) (aref (cdr elt) 0) + (package-desc-version (cadr elt))) (package-desc-version (cadr available))))) - (package-vc-p (cadr (assq (car elt) package-alist))))) - package-alist))) + (and (consp (cdr elt)) + (package-desc-p (cadr elt)) + (package-vc-p (cadr elt))))) + (seq-union package-alist package--builtins + (lambda (a b) (eq (car a) (car b))))))) ;;;###autoload (defun package-update-all (&optional query) The only thing that's slightly inelegant/hard-to-follow is that the format of package-alist is different than package--builtins. Lots of consp, cdr-taking, vectorp and so on. Besides that, it's a question of taking the union of the two sets and operating on that. This also relies on seq-union's undocumented behavior of keeping the first of any duplicates. Feel free to rewrite. Jo=C3=A3o