all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Removing packages from archive-contents if removed from elpa-packages
Date: Mon, 31 Oct 2022 16:06:12 +0000	[thread overview]
Message-ID: <87bkpsgeq3.fsf@posteo.net> (raw)
In-Reply-To: <87wn8ggjdo.fsf@posteo.net> (Philip Kaludercic's message of "Mon,  31 Oct 2022 15:25:39 +0100")

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

Philip Kaludercic <philipk@posteo.net> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Remove-deleted-packages-from-archive-contents.patch --]
[-- Type: text/x-patch, Size: 3093 bytes --]

From 092dfa49a6735c5a00565ea51dcf2272ba9b64ff Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
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


  parent reply	other threads:[~2022-10-31 16:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31  9:40 Removing packages from archive-contents if removed from elpa-packages Philip Kaludercic
2022-10-31 12:11 ` Stefan Monnier
2022-10-31 14:25   ` Philip Kaludercic
2022-10-31 14:47     ` Stefan Kangas
2022-10-31 15:10       ` Philip Kaludercic
2022-10-31 16:06     ` Philip Kaludercic [this message]
2022-10-31 17:53       ` Stefan Monnier
2022-11-01 10:42         ` Philip Kaludercic
2022-11-02  2:02           ` Stefan Monnier
2022-11-02  6:59             ` Philip Kaludercic

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkpsgeq3.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.