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: Re: Removing packages from archive-contents if removed from elpa-packages Date: Mon, 31 Oct 2022 16:06:12 +0000 Message-ID: <87bkpsgeq3.fsf@posteo.net> References: <878rkwe3fv.fsf@posteo.net> <87wn8ggjdo.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="30883"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 31 17:08:49 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 1opXLF-0007nC-0F for ged-emacs-devel@m.gmane-mx.org; Mon, 31 Oct 2022 17:08:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opXKk-0000At-VL; Mon, 31 Oct 2022 12:08:21 -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 1opXIv-00085I-Qc for emacs-devel@gnu.org; Mon, 31 Oct 2022 12:06:31 -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 1opXIt-0005Ay-4J for emacs-devel@gnu.org; Mon, 31 Oct 2022 12:06:25 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E5FF6240101 for ; Mon, 31 Oct 2022 17:06:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667232373; bh=qLVR6KdKVC/Ou4vw92ZDW40eKFxmvHsZBvCm3bjMq6w=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=r+klwahILLli7bBad5T61Yq/R+FRF5maZsrC2c/Ng35NusJy+usHQP3eDZHKhlKfE 7sJMocvly8nA91je+JBc9yYDfSNWP2lq8bBcE6hKNs9OXFd2lfJPL5F2d2suOFxFft K7IRN6uYkaf4vjowwWWqh0CDFljYdtETLXJGUjRQuQVb1aeG5t7Lxo1OoGMW990zLG DTUDS/z8B/DuW0E6PnlhJH5YyvfyQahMwv2wfdszqOlsmsMfNUn74dDP8KBUmtFm5J jV6g67s8Qb2X1oJ8nrxFsYa/vyGaUzgVCmtzBd8EIulA90b/IMx3rNXhe63Jf2Ca7T IW9VEgQFC+yhQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N1J106TCzz9rxH; Mon, 31 Oct 2022 17:06:12 +0100 (CET) In-Reply-To: <87wn8ggjdo.fsf@posteo.net> (Philip Kaludercic's message of "Mon, 31 Oct 2022 15:25:39 +0100") 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+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298869 Archived-At: --=-=-= Content-Type: text/plain Philip Kaludercic writes: > Stefan Monnier writes: > >> Philip Kaludercic [2022-10-31 09:40:36] wrote: >>> 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: >> >> Thanks, but I don't think `elpaa--update-archive-contents` is the right >> place for that. This can be called N times for a given invocation of >> `elpaa-batch-make-all-packages`. >> Why not call a dedicated function from `elpaa-batch-make-all-packages` >> (i.e. alongside the call to `elpaa--publish-package-specs`)? > > That can be done. It has been done: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Remove-deleted-packages-from-archive-contents.patch >From 092dfa49a6735c5a00565ea51dcf2272ba9b64ff Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 31 Oct 2022 17:01:07 +0100 Subject: [PATCH 1/2] Remove deleted packages from archive-contents * elpa-admin.el (elpaa--write-archive-contents): Extract from 'elpaa--update-archive-contents' (elpaa--update-archive-contents): Use 'elpaa--write-archive-contents'. (elpaa--scrub-archive-contents): Add function. (elpaa-batch-make-all-packages): Call 'elpaa--scrub-archive-contents'. --- elpa-admin.el | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/elpa-admin.el b/elpa-admin.el index c03fea47a1..738a957966 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -154,6 +154,14 @@ Delete backup files also." (backup-file-name-p f)) (delete-file f))))) +(defun elpaa--write-archive-contents (ac dir) + "Write archive contents AC into directory DIR." + (with-temp-buffer + (pp ac (current-buffer)) + (write-region nil nil (expand-file-name "archive-contents" dir))) + (let ((default-directory (expand-file-name dir))) + (elpaa--html-make-index (cdr ac)))) + (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)) @@ -166,11 +174,7 @@ Delete backup files also." (lambda (x y) (string-lessp (symbol-name (car x)) (symbol-name (car y)))))) (elpaa--message "new AC: %S" ac) - (with-temp-buffer - (pp ac (current-buffer)) - (write-region nil nil filename) - (let ((default-directory (expand-file-name dir))) - (elpaa--html-make-index (cdr ac)))))) + (elpaa--write-archive-contents ac dir))) (defun elpaa--get-specs () (elpaa--form-from-file-contents elpaa--specs-file)) @@ -788,6 +792,21 @@ of the current `process-environment'. Return the modified copy." (list pkgname)) spec))) +(defun elpaa--scrub-archive-contents (dir) + "Remove dead packages from archive contents in DIR." + (let* ((filename (expand-file-name "archive-contents" dir)) + (ac (if (file-exists-p filename) + (elpaa--form-from-file-contents filename) + '(1))) + (specs (elpaa--get-specs))) + (elpaa--write-archive-contents + (cons (car ac) + (mapcan + (lambda (pkg) + (and (assoc (car pkg) specs #'string=) (list pkg))) + (cdr ac))) + dir))) + (defun elpaa--publish-package-specs (specs) "Process and publish SPECS in elpa-packages.eld files." (with-temp-buffer @@ -814,6 +833,8 @@ of the current `process-environment'. Return the modified copy." (defun elpaa-batch-make-all-packages (&rest _) "Check all the packages and build the relevant new tarballs." + (elpaa--scrub-archive-contents elpaa--release-subdir) + (elpaa--scrub-archive-contents elpaa--devel-subdir) (let ((specs (elpaa--get-specs))) (dolist (spec specs) (condition-case err -- 2.38.0 --=-=-=--