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.devel Subject: Removing packages from archive-contents if removed from elpa-packages Date: Mon, 31 Oct 2022 09:40:36 +0000 Message-ID: <878rkwe3fv.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="6850"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 31 10:41:32 2022 Return-path: Envelope-to: ged-emacs-devel@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 1opRIS-0001bN-0G for ged-emacs-devel@m.gmane-mx.org; Mon, 31 Oct 2022 10:41:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opRHj-0005ka-Us; Mon, 31 Oct 2022 05:40:47 -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 1opRHi-0005iq-7F for emacs-devel@gnu.org; Mon, 31 Oct 2022 05:40:46 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opRHg-0001wg-EC for emacs-devel@gnu.org; Mon, 31 Oct 2022 05:40:45 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 55AE9240101 for ; Mon, 31 Oct 2022 10:40:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667209242; bh=EbRS4iE0AjjA/gtjMSqtPn8LAfHJ/0zD1ddrIM29GQQ=; h=From:To:Subject:Autocrypt:Date:From; b=fgg+I/qaEE87IX3iwLwpNRzbXYWUtlyLUh0pWYWCSNwecnHHBlsWGq0PuXEMLCD8v THmFX5cm1MCFpVh8ZKOiySEEfWZtgiJ7bOuJPpZGV0pDH1756Gd9Dc1ROK1HQPLys2 QblES+sQsWg3wzaCcrTW/lLQUcAMNWbiAJBseLtSrFQ2QubEJnDB3EMiEU4YGi6R1Q YXkO/mnJEpBN8MR3dQNzAJmIRGW5VhIlld2Qd0lAOK8lRpAvk97g3JtqCS3FS+KqQ1 YVaq7/Oww8aUI41hdYoN1CWXcwDXI5SQzZxG7cJdcfWYnXUVqSGsEoidK6bFKI3ZTw ZBPo/uIZzuiZA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N17S725Wvz9rxT for ; Mon, 31 Oct 2022 10:40:36 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298840 Archived-At: --=-=-= Content-Type: text/plain Hi, there is at least one broken package on NonGNU ELPA (color-theme-tangotango) that was added, then removed as dependencies were missing, but it remained in the archive because it was added to the archive-contents file. The following patch would make sure that any package not listed in elpa-packages is also remove from archive-contents: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Remove-packages-from-archive-if-they-are-not-listed-.patch >From 501309b5507e9e87eb59fbaab65184ee915a5386 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 31 Oct 2022 10:18:17 +0100 Subject: [PATCH] Remove packages from archive if they are not listed in elpa-packages * elpa-admin.el (elpaa--update-archive-contents): Cross-examine the package specifications before updating archive contents. --- elpa-admin.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/elpa-admin.el b/elpa-admin.el index c03fea47a1..ac36aa686a 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -156,15 +156,19 @@ Delete backup files also." (defun elpaa--update-archive-contents (pkg-desc dir) "Update the `archive-contents' file in DIR with new package PKG-DESC." - (let* ((filename (expand-file-name "archive-contents" dir)) + (let* ((specs (elpaa--get-specs)) + (filename (expand-file-name "archive-contents" dir)) (ac (if (file-exists-p filename) (elpaa--form-from-file-contents filename) '(1)))) (elpaa--message "current AC: %S" ac) (setf (alist-get (car pkg-desc) (cdr ac)) (cdr pkg-desc)) - (setf (cdr ac) (sort (cdr ac) - (lambda (x y) - (string-lessp (symbol-name (car x)) (symbol-name (car y)))))) + (setf (cdr ac) + (sort (mapcan + (lambda (pkg) + (and (assoc (car pkg) specs #'string=) (list pkg))) + (cdr ac)) + (lambda (x y) (string-lessp (car x) (car y))))) (elpaa--message "new AC: %S" ac) (with-temp-buffer (pp ac (current-buffer)) -- 2.38.0 --=-=-= Content-Type: text/plain It might be a good idea to cache the interpretation of elpa-packages, so I would also suggest the following: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Cache-elpaa-get-specs-invocations.patch >From 539e36cc448315cb26bae400cb52de4308a0a747 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 31 Oct 2022 10:35:21 +0100 Subject: [PATCH] Cache 'elpaa--get-specs' invocations * elpa-admin.el (elpa--specs-cache): Add new variable. (elpaa--get-specs): Use 'elpa--specs-cache'. --- elpa-admin.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elpa-admin.el b/elpa-admin.el index ac36aa686a..3fb1d756fb 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -176,8 +176,11 @@ Delete backup files also." (let ((default-directory (expand-file-name dir))) (elpaa--html-make-index (cdr ac)))))) +(defvar elpa--specs-cache nil) + (defun elpaa--get-specs () - (elpaa--form-from-file-contents elpaa--specs-file)) + (or elpa--specs-cache + (setq elpa--specs-cache (elpaa--form-from-file-contents elpaa--specs-file)))) (defun elpaa--spec-get (pkg-spec prop &optional default) (or (plist-get (cdr pkg-spec) prop) default)) -- 2.38.0 --=-=-= Content-Type: text/plain While this would fix the above problem, two points remain: 1. This does not remove any tarballs. It wouldn't be hard to do, but I am not sure if there would be any unintended side effects of doing so -- at least immediately. 2. There are functioning packages on NonGNU ELPA like haskell-mode that were also added to elpa-packages then removed, and still linger in the archive without being updated. This would get rid of those too, which might not be a good idea. --=-=-=--