[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Removing packages from archive-contents if removed from elpa-package
From: |
Stefan Monnier |
Subject: |
Re: Removing packages from archive-contents if removed from elpa-packages |
Date: |
Mon, 31 Oct 2022 13:53:18 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> +(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).