From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: package.el dependencies Date: Mon, 2 Feb 2015 15:50:54 +0000 Message-ID: References: <87wq4dpqib.fsf@gmail.com> <87wq44su8v.fsf@gmail.com> <877fw3789y.fsf@gmail.com> <874mr4sbfa.fsf@gmail.com> <87386os8mq.fsf@gmail.com> <87k3009w8z.fsf@gmail.com> <87iofk9vlj.fsf@gmail.com> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1422892301 18813 80.91.229.3 (2 Feb 2015 15:51:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Feb 2015 15:51:41 +0000 (UTC) Cc: Stefan Monnier , emacs-devel To: Thierry Volpiatto Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 02 16:51:40 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 1YIJHn-0004IU-OP for ged-emacs-devel@m.gmane.org; Mon, 02 Feb 2015 16:51:39 +0100 Original-Received: from localhost ([::1]:55229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIJHn-0008Rm-5L for ged-emacs-devel@m.gmane.org; Mon, 02 Feb 2015 10:51:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIJH6-0007pe-NQ for emacs-devel@gnu.org; Mon, 02 Feb 2015 10:50:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIJH5-0002j8-Oc for emacs-devel@gnu.org; Mon, 02 Feb 2015 10:50:56 -0500 Original-Received: from mail-ob0-x234.google.com ([2607:f8b0:4003:c01::234]:40204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIJH5-0002ix-L2 for emacs-devel@gnu.org; Mon, 02 Feb 2015 10:50:55 -0500 Original-Received: by mail-ob0-f180.google.com with SMTP id vb8so17119133obc.11 for ; Mon, 02 Feb 2015 07:50:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=BQ/Q2R7S76+TD7AZhHO9ODnazVppU1fHN0KtYzuSECw=; b=HAyu7TWxD5OdPYXGZJIMn6O5haE8hb8Na3pkqDlp7wNIUDJr9T4/dPVFk3EU96UAjW /7QzD8djJNPsZqJdeVpp+EyE8FqViNZEXUDnkb3nHy4YquuXW/7ulKzIpTx+w0D8gHWR KZZeJVHILmskYSZOthpNwyQsqbft5wX7yIPKl8FM7S7Vzy+v56bkInjEqXLdwxyVpQgl OkwysDDhg/pUyCFoBQ4aLX5hWebktR0BZxGMCtd9ZLv9biyucKRS1V7QgxVgxr3Wisni ALSFKe4BWtiw2tSntAqBJgayUYqS6dRV1C8cL2VL9++qEiH29fQUFJ73xzCVGg55FA/8 HzEA== X-Received: by 10.182.131.231 with SMTP id op7mr12515088obb.46.1422892255052; Mon, 02 Feb 2015 07:50:55 -0800 (PST) Original-Received: by 10.76.125.1 with HTTP; Mon, 2 Feb 2015 07:50:54 -0800 (PST) In-Reply-To: <87iofk9vlj.fsf@gmail.com> X-Google-Sender-Auth: 7b_JSEscsbrVkR8K5f8RBc5SsoQ X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::234 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:182260 Archived-At: 2015-02-02 15:33 GMT+00:00 Thierry Volpiatto : > > Thierry Volpiatto writes: > >>> 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). > > Consider following example using this definition of package--get-deps: > > --8<---------------cut here---------------start------------->8--- > (defun package--get-deps (pkg &optional only) > (let* ((pkg-desc (cadr (assq pkg package-alist))) > (direct-deps (cl-loop for p in (package-desc-reqs pkg-desc) > for name = (car p) > when (assq name package-alist) > collect name)) > (indirect-deps (unless (eq only 'direct) > (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)) > (indirect indirect-deps) > (t (append direct-deps indirect-deps))))) > --8<---------------cut here---------------end--------------->8--- I think the snippet you suggest lists 1st and 2nd order dependencies. It does not, in general, list all dependencies without duplicates. > Here the dependencies of the package "jedi": > [...] > As you can see all the dependencies are here and there is no duplicates. In this particular case, yes, but that's just a coincidence. What the function is actually doing, is to return 1st and 2nd order dependencies. I explain below: 1st order dependencies > (package--get-deps 'jedi 'direct) > =>(epc auto-complete python-environment) 2nd order dependencies > (package--get-deps 'epc 'direct) > =>(concurrent ctable) > (package--get-deps 'auto-complete 'direct) > =>(popup) > (package--get-deps 'python-environment 'direct) > =>(deferred) 3rd order dependencies: > (package--get-deps 'concurrent 'direct) > =>(deferred) > (package--get-deps 'ctable 'direct) > =>nil Union of the 1st and 2nd order: > (package--get-deps 'jedi) > =>(epc auto-complete python-environment concurrent ctable popup deferred) 1. The only reason you don't get duplicates there, is because the dependencies of the concurrent and ctable packages are not even being looked at. 2. Similarly, the only reason you don't have omissions in the resulting list, is because these two packages don't depend on anything different from the other packages. If 'ctable or 'concurrent happened to depend on X, then X would not show up on your returned list.