From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#74556: 30.0.92; Package upgrade can fail and results in deleted package Date: Thu, 28 Nov 2024 11:34:51 +0000 Message-ID: <87v7w7617o.fsf@posteo.net> References: <87plmgq55e.fsf@daniel-mendler.de> <87zflj62ai.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11850"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74556@debbugs.gnu.org To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 28 12:36:22 2024 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 1tGcon-0002vU-Sz for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Nov 2024 12:36:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGcoZ-0003Rw-EY; Thu, 28 Nov 2024 06:36:07 -0500 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 1tGcoW-0003Rk-Nz for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 06:36:05 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGcoU-0004Li-Hg for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 06:36:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=gaCpvAuVUBo9Rh5YFCI2ibfdGyxBcEOfQb8jgzlRIWQ=; b=I60PRRD5075bWXTYVF+ZhLurfOoVb4zy50OwnDF4pFcHIFsYijcH+3f11FRqrPzhPwZD/qRI9zr+WKKF1+ZANVw9+cR3hKNh+PG0IWPQyCu4lvEoOlMy75ndAPsn5wGDBqooQWPQs0Yd7WJ5fdDGA0xvHbgfLFXir2p2JHCnUR5OZSKdY9W70F7NBfuqIbI7bju+ZMgotrEE94P/UDEjs+lgn5QnB1VomzDZsq/QIR5bjQRuQmQye3cUSsNwkOfnlyg0Bg+TrhMdzXPAMIHR7jMMeDuDCuL2ibjBGev3IGjwV1xZoKueonWQpAiuA5KfNTebAGTIlZHZYWJkCiDIPg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tGcoT-00041d-Va for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 06:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Nov 2024 11:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74556 X-GNU-PR-Package: emacs Original-Received: via spool by 74556-submit@debbugs.gnu.org id=B74556.173279370815290 (code B ref 74556); Thu, 28 Nov 2024 11:36:01 +0000 Original-Received: (at 74556) by debbugs.gnu.org; 28 Nov 2024 11:35:08 +0000 Original-Received: from localhost ([127.0.0.1]:37023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGcnc-0003xp-8h for submit@debbugs.gnu.org; Thu, 28 Nov 2024 06:35:08 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:35159) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGcnZ-0003th-ED for 74556@debbugs.gnu.org; Thu, 28 Nov 2024 06:35:06 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 38A76240027 for <74556@debbugs.gnu.org>; Thu, 28 Nov 2024 12:34:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1732793699; bh=jANIS1/Ibek+mGi11K5E2mMP8Yi5JufGdsr4Bctnrx0=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=C/FeHqbdG+Ks+53dltvD0CfnpnQ2dlVfR6TLouwq7jWBPYxJQxLGgjqb9gM35Qxu+ 4Ip2eQK6//P/ntI5FiAR/ihTafc3HeU9WBlvHk6WtVEZNzp/WsM93PIjsuCiQc4oww WmkQy/lCdGNV2dAQmgU0aJjsBrszSq0q37jISC9pAw3nC+zkKz0eYtS39/enVkN905 LGYmLCekyMoG+BmVZZVh6NzdldImDBJc0q500HRsEBUEAA8Yn3qwKQFOv1+5bTMWYZ CA5M9xfXQ8tdRFyxD+8CUmiN2Bz/cNgt4xS3t+8DQm87BkZvBEZKjM10nCDn+8d3Fm PJyB9vD02xo/g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4XzZ3j1Nf0z9rxK; Thu, 28 Nov 2024 12:34:57 +0100 (CET) In-Reply-To: <87zflj62ai.fsf@posteo.net> (Philip Kaludercic's message of "Thu, 28 Nov 2024 11:11:33 +0000") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt 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:296052 Archived-At: --=-=-= Content-Type: text/plain Philip Kaludercic writes: [...] > It might make sense to try and "deactivate" a package before installing > the new package. Looking into some second-try fallback for > package-install to refresh the package index if a package was not found > would also be a good idea ^^ This might do it? --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 438af781393..3800d8fa56d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2095,7 +2095,7 @@ package-archive-base "Return the package described by DESC." (cdr (assoc (package-desc-archive desc) package-archives))) -(defun package-install-from-archive (pkg-desc) +(defun package-install-from-archive-1 (pkg-desc) "Download and install a package defined by PKG-DESC." ;; This won't happen, unless the archive is doing something wrong. (when (eq (package-desc-kind pkg-desc) 'dir) @@ -2141,6 +2141,15 @@ package-install-from-archive package-alist)))) (setf (package-desc-signed (car pkg-descs)) t)))))))))) +(defun package-install-from-archive (pkg-desc) + "Download and install PKG-DESC, refreshing the archive if necessary." + (condition-case msg + (package-install-from-archive-1 pkg-desc) + (error + (when (string-match-p "\\`Error retrieving: " (cadr msg)) + (package-refresh-contents) + (package-install-from-archive-1 pkg-desc))))) + ;;;###autoload (defun package-installed-p (package &optional min-version) "Return non-nil if PACKAGE, of MIN-VERSION or newer, is installed. --=-=-=--