From: Thierry Volpiatto <thievol@posteo.net>
To: Philip Kaludercic <philipk@posteo.net>
Cc: Thierry Volpiatto <thievol@posteo.net>,
Eli Zaretskii <eliz@gnu.org>,
72141@debbugs.gnu.org
Subject: bug#72141: 29.4; package-upgrade vs package-load-list
Date: Sun, 04 Aug 2024 17:15:04 +0000 [thread overview]
Message-ID: <87ikwgjjl3.fsf@posteo.net> (raw)
In-Reply-To: <8734nkz67g.fsf@posteo.net> (Philip Kaludercic's message of "Sun, 04 Aug 2024 14:57:23 +0000")
[-- Attachment #1.1: Type: text/plain, Size: 232 bytes --]
Hello Philip,
Philip Kaludercic <philipk@posteo.net> writes:
> Gladly, then I'd like to try it out it and perhaps write a ERT test.
Patch attached, please review and test it before merging ;-)
Thanks.
--
Thierry
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Fix-bug-72141-package-upgrade-should-not-include-dis.patch --]
[-- Type: text/x-diff, Size: 4983 bytes --]
From 292e251a383c1fb53cc377cd32f71705e6742f85 Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thievol@posteo.net>
Date: Sat, 3 Aug 2024 06:07:28 +0200
Subject: [PATCH] Fix bug#72141, package-upgrade should not include disabled
packages
* lisp/emacs-lisp/package.el (package--upgradeable-packages):
Rewrite with a new optional arg to filter out disabled packages from
output.
(package-upgrade, package-upgrade-all): Use it and filter out built-in
packages from completion according package-install-upgrade-built-in
value.
---
lisp/emacs-lisp/package.el | 60 ++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 25 deletions(-)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 7cae8d68bc0..83996c9d6de 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2259,11 +2259,15 @@ had been enabled."
"Upgrade package NAME if a newer version exists."
(interactive
(list (completing-read
- "Upgrade package: " (package--upgradeable-packages t) nil t)))
+ "Upgrade package: " (package--upgradeable-packages
+ package-install-upgrade-built-in
+ 'ignore-disabled)
+ nil t)))
(let* ((package (if (symbolp name)
name
(intern name)))
(pkg-desc (cadr (assq package package-alist)))
+ ;; Keep this binding for non-interactive use.
(package-install-upgrade-built-in (not pkg-desc)))
;; `pkg-desc' will be nil when the package is an "active built-in".
(if (and pkg-desc (package-vc-p pkg-desc))
@@ -2275,32 +2279,37 @@ had been enabled."
;; before. Mark it as installed explicitly.
(and pkg-desc 'dont-select)))))
-(defun package--upgradeable-packages (&optional include-builtins)
+(defun package--upgradeable-packages (&optional
+ include-builtins ignore-disabled)
;; Initialize the package system to get the list of package
;; symbols for completion.
(package--archives-initialize)
- (mapcar
- #'car
- (seq-filter
- (lambda (elt)
- (or (let ((available
- (assq (car elt) package-archive-contents)))
- (and available
- (or (and
- include-builtins
- (not (package-desc-version (cadr elt))))
- (version-list-<
- (package-desc-version (cadr elt))
- (package-desc-version (cadr available))))))
- (package-vc-p (cadr elt))))
- (if include-builtins
- (append package-alist
- (mapcan
- (lambda (elt)
- (when (not (assq (car elt) package-alist))
- (list (list (car elt) (package--from-builtin elt)))))
- package--builtins))
- package-alist))))
+ (let ((pkgs (if include-builtins
+ (append package-alist
+ (append package-alist
+ (mapcan
+ (lambda (elt)
+ (when (not (assq (car elt) package-alist))
+ (list
+ (list
+ (car elt)
+ (package--from-builtin elt)))))
+ package--builtins)))
+ package-alist)))
+ (cl-loop for (sym desc) in pkgs
+ for available =
+ (if-let ((av (assq sym package-archive-contents)))
+ (if ignore-disabled
+ (and (not (package-disabled-p sym cversion)) av) av))
+ for cversion = (and available (package-desc-version desc))
+ when (or (and available
+ (or (and include-builtins (not cversion))
+ (and cversion
+ (version-list-<
+ cversion
+ (package-desc-version (cadr available))))))
+ (package-vc-p desc))
+ collect sym)))
;;;###autoload
(defun package-upgrade-all (&optional query)
@@ -2315,7 +2324,8 @@ from ELPA by either using `\\[package-upgrade]' or
`\\<package-menu-mode-map>\\[package-menu-mark-install]' after `\\[list-packages]'."
(interactive (list (not noninteractive)))
(package-refresh-contents)
- (let ((upgradeable (package--upgradeable-packages)))
+ (let ((upgradeable (package--upgradeable-packages
+ package-install-upgrade-built-in 'ignore-disabled)))
(if (not upgradeable)
(message "No packages to upgrade")
(when (and query
--
2.34.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]
next prev parent reply other threads:[~2024-08-04 17:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 14:46 bug#72141: 29.4; package-upgrade vs package-load-list Thierry Volpiatto
2024-07-27 7:14 ` Eli Zaretskii
2024-07-28 11:47 ` Philip Kaludercic
2024-07-28 12:27 ` Thierry Volpiatto
2024-07-28 12:27 ` Eli Zaretskii
2024-07-28 12:39 ` Thierry Volpiatto
2024-08-01 6:48 ` Thierry Volpiatto
2024-08-03 3:22 ` Thierry Volpiatto
2024-08-04 14:57 ` Philip Kaludercic
2024-08-04 17:15 ` Thierry Volpiatto [this message]
2024-08-10 17:16 ` Thierry Volpiatto
2024-08-12 16:36 ` Philip Kaludercic
2024-08-12 17:36 ` Thierry Volpiatto
2024-08-12 18:16 ` Thierry Volpiatto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ikwgjjl3.fsf@posteo.net \
--to=thievol@posteo.net \
--cc=72141@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=philipk@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).