emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing packages from archive-contents if removed from elpa-package


From: Philip Kaludercic
Subject: Re: Removing packages from archive-contents if removed from elpa-packages
Date: Tue, 01 Nov 2022 10:42:37 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

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

No, you are absolutely right, I just didn't see that.

Attachment: 0001-Remove-deleted-packages-from-archive-contents.patch
Description: Text Data

>
>         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).

It is slightly more complicated, if only because I extracted
`elpaa--write-archive-contents', but I think it is a lot cleaner than my
first approach.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]