unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Philip Kaludercic <philipk@posteo.net>
Cc: emacs-devel@gnu.org
Subject: Re: Removing packages from archive-contents if removed from elpa-packages
Date: Mon, 31 Oct 2022 13:53:18 -0400	[thread overview]
Message-ID: <jwvmt9b51g4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87bkpsgeq3.fsf@posteo.net> (Philip Kaludercic's message of "Mon,  31 Oct 2022 16:06:12 +0000")

> +(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

Hmm... in `elpaa--scrub-archive-contents` you `elpaa--get-specs` but you
could skip that if you called this function a tiny bit later and passed
`specs` to it instead, right?


        Stefan


PS: Haven't really looked at the rest of the patch, actually, this part
just jumped at me.  But now that I see how this is more complex than
your original patch, maybe doing it N times is the better option (and if
not, we can add a global boolean var telling us if we've done it
already).




  reply	other threads:[~2022-10-31 17:53 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
2022-10-31 17:53       ` Stefan Monnier [this message]
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

  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=jwvmt9b51g4.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@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).