From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: package.el dependencies Date: Mon, 26 Jan 2015 05:48:50 +0100 Message-ID: <87fvay2ll9.fsf@gmail.com> References: <87wq4dpqib.fsf@gmail.com> <87siez2p79.fsf@gmail.com> <87y4oqg8tg.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422247749 26545 80.91.229.3 (26 Jan 2015 04:49:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2015 04:49:09 +0000 (UTC) Cc: Stefan Monnier , emacs-devel To: bruce.connor.am@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 26 05:49:09 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFbbn-0005lP-2v for ged-emacs-devel@m.gmane.org; Mon, 26 Jan 2015 05:49:07 +0100 Original-Received: from localhost ([::1]:39975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFbbm-0003wQ-48 for ged-emacs-devel@m.gmane.org; Sun, 25 Jan 2015 23:49:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFbbh-0003wK-Ui for emacs-devel@gnu.org; Sun, 25 Jan 2015 23:49:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFbbe-0006Bb-Lg for emacs-devel@gnu.org; Sun, 25 Jan 2015 23:49:01 -0500 Original-Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:33047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFbbe-0006BV-FK for emacs-devel@gnu.org; Sun, 25 Jan 2015 23:48:58 -0500 Original-Received: by mail-wg0-f47.google.com with SMTP id n12so6960344wgh.6 for ; Sun, 25 Jan 2015 20:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; bh=9v0G9PhQcJawAv7hpaO7gvuJL9Cw0IiII6nxMEpUuAs=; b=irUMYvFO5dsovI+pS5M3imAG5lExmVPoev9ZXa/JxkOQdtZcBcqCR9/VGlkCz+SxUB KC91MAz5lN3l4ygMdm93VMKnuP6uIEwcnj2VjDJBzWzo7/dDt9kELTiiFqz0X4gbOfqz 9xZrKXw4gZePScNxtVQ7HMtBHbpaQaZReaxlhOQd0S9We2CEfZ8VAN4VIft00qyBNI2t bKSqTmyvKUWwjcVSWzPOeEsMwx3k0KciXtysy69bMFx91dPU69O/bucwG6SpBGwgIwPk HjloYLxY1gOzoaimvLGUOy0LJJxnujJwFvDb6hSFBUr+oIKMe4CSdwTqC3Lv28rSXyoz rLUQ== X-Received: by 10.194.24.68 with SMTP id s4mr14238085wjf.98.1422247737805; Sun, 25 Jan 2015 20:48:57 -0800 (PST) Original-Received: from dell-14z ([37.161.98.145]) by mx.google.com with ESMTPSA id lg7sm12296740wic.0.2015.01.25.20.48.55 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 25 Jan 2015 20:48:56 -0800 (PST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181773 Archived-At: Artur Malabarba 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