emacs-devel
[Top][All Lists]
Advanced

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

Re: package.el dependencies


From: Thierry Volpiatto
Subject: Re: package.el dependencies
Date: Mon, 26 Jan 2015 05:48:50 +0100

Artur Malabarba <address@hidden> writes:

>> +(defun package-used-elsewhere-p (pkg)
>> +  "Check if PKG is used elsewhere as dependency.
>> +Argument PKG is a symbol."
>> +  (cl-loop with alist = (remove (assoc pkg package-alist) package-alist)
>> +           for p in alist thereis
>> +           (member pkg (mapcar 'car (package-desc-reqs (cadr p))))))
>
> `package-used-elsewhere-p' might as well return a list of the
> conflicts (and say that in the docstring). I'm not entirely familiar
> with the `thereis' in `cl-loop' so maybe that's already being done
> here?
> In any case, that would certainly be useful below.

That would be maybe useful for the next step of this work, but for now I
did like this to not loop further as soon a conflict is detected, IOW
stop at first conflict.

>>  (defun package-delete (pkg-desc)
>
> Just a suggestion.
> I think it would be useful to add an optional SOFT or NOERROR argument
> now, which would silently not-delete packages instead of erroring. It
> will probably be useful for automatic dependency removal.

Yes agree, I was not sure what to do here, so I just throw an error as a
starting point, will see later this, probably we will need also a
reinstall command, which run delete with noerror.

> Why not use the package-desc getters?

Because package-desc-reqs returns only the direct dependencies of a
package, we have to check all dependencies, for example the package
"jedi" have 3 direct dependencies and 4 indirect dependencies (or may be 4
and 3).

>> +           ;; Don't delete packages used as dependency elsewhere.
>> +           (error "Package `%s' is used elsewhere as dependency, not 
>> deleting"
>> +                  (package-desc-full-name pkg-desc)))
>
> As already said, please say where the conflicts occurred. If
> `package-used-elsewhere-p' returned a list, you could use it here to
> report the conflicts.

Unless I really need it for something else, no, I will report only the
first conflict encountered.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 



reply via email to

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