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, 02 Feb 2015 16:19:24 +0100 Message-ID: <87k3009w8z.fsf@gmail.com> References: <87wq4dpqib.fsf@gmail.com> <87wq44su8v.fsf@gmail.com> <877fw3789y.fsf@gmail.com> <874mr4sbfa.fsf@gmail.com> <87386os8mq.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422891383 2682 80.91.229.3 (2 Feb 2015 15:36:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Feb 2015 15:36:23 +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 Feb 02 16:36:22 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 1YIJ2y-00081W-KB for ged-emacs-devel@m.gmane.org; Mon, 02 Feb 2015 16:36:20 +0100 Original-Received: from localhost ([::1]:55182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIJ2x-0000yG-Sw for ged-emacs-devel@m.gmane.org; Mon, 02 Feb 2015 10:36:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIImo-000200-6m for emacs-devel@gnu.org; Mon, 02 Feb 2015 10:19:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIImh-0000ZN-Iv for emacs-devel@gnu.org; Mon, 02 Feb 2015 10:19:36 -0500 Original-Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:52387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIImh-0000Yb-Cf for emacs-devel@gnu.org; Mon, 02 Feb 2015 10:19:31 -0500 Original-Received: by mail-we0-f173.google.com with SMTP id w62so39677455wes.4 for ; Mon, 02 Feb 2015 07:19:30 -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=KMoTLVH+tI3b6pjZ7mcvRZFcrZC1bZqugh3uNXb5XeA=; b=ii+RdqaX+pj4inCNN+75pReigiYtDO42wWcpLQyqN6yKe6VtUjRuGgpAVAAFbCkKLQ cfUz8hIQpsuk78wYKQw/RwhI8krn62EkjE+QHe9DFskLYQusmSQasb1zDl0HbORqjsrl lhIPo1Ghh8nNq5jrLpkcc3ZJfiKgRTSHpw5ngs8u7gMmb3bAzDzJm/gcf9HKHFq46kUo qDcIXGh2iE55XaAxHA8w4rw07cfft0RAlDyi3TuArOmDet/jRRN1Cqdsuvz+blPI0pfX KGwP0Etkl+FrISmVU6Bjc3rVqpBwk2euUnBhnhe4lNm4uxVWUzHPPoZq+Nt1Xy4kk2ow E6uw== X-Received: by 10.180.88.193 with SMTP id bi1mr25372591wib.70.1422890370678; Mon, 02 Feb 2015 07:19:30 -0800 (PST) Original-Received: from dell-14z ([37.163.229.5]) by mx.google.com with ESMTPSA id hm6sm17580476wjb.32.2015.02.02.07.19.27 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 07:19:29 -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:c03::22d 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:182259 Archived-At: Artur Malabarba writes: >>> We have now duplicates with package--get-deps: >>> >>> (package--get-deps 'jedi) >>> =>(epc auto-complete python-environment epc auto-complete >>> python-environment >>> concurrent ctable concurrent ctable deferred deferred >>> popup popup deferred deferred) >>> >>> As a workaround, you can use delete-dups, but this need to be >>> implemented differently IMO. >> >> Maybe like this: >> >> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el >> index 9a29d63..2157174 100644 >> --- a/lisp/emacs-lisp/package.el >> +++ b/lisp/emacs-lisp/package.el >> @@ -1428,9 +1428,8 @@ The file can either be a tar file or an Emacs Lisp file." >> when (assq name package-alist) >> collect name)) >> (indirect-deps (unless (eq only 'direct) >> - (apply #'append >> - direct-deps > > Yes, I made a mistake by adding the `direct-deps' here. I'll remove it. > >> - (mapcar #'package--get-deps direct-deps))))) >> + (cl-loop for p in direct-deps >> + append (package--get-deps p 'direct))))) >> (cl-case only >> (direct direct-deps) >> (separate (list direct-deps indirect-deps)) >> >> (package--get-deps 'jedi) >> => (epc auto-complete python-environment concurrent ctable popup deferred) > > It may have solved this particular example, but if two direct > dependencies share the same (indirect) dependency then this will still > lead to duplicates. We could try writting an efficient way of avoiding > this duplicates, but I'm fine with just using `delete-dups'. Yes I think using delete-dups is ok for the extras duplicates in this case, but see below to avoid most of the duplicates. So it would be: (cl-loop for p in direct-deps append (package--get-deps p 'direct) into deps finally return (delete-dups deps)) > And one more thing. Why did you use `(package--get-deps p 'direct)' in > this snippet? Passing the `direct' argument will cause it to only > return 2nd level dependencies at most (direct dependencies of the > direct dependencies). Don't think so, see below. > I think it should be just `(package--get-deps p)', shouldn't it? No, this avoid duplicates and it will in turn recurse in the direct dependency of the dependency and so on, if you don't specify 'direct you will have immediately duplicates. > This way it'll keep searching untill the bottom of the dependency > tree. It will with the recursion and the 'direct flag. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997