From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tim Cross Newsgroups: gmane.emacs.devel Subject: Re: Package.el and specifying alternative dependencies Date: Wed, 12 Apr 2017 17:35:57 +1000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1145a5e661267c054cf3424e X-Trace: blaine.gmane.org 1491982609 32548 195.159.176.226 (12 Apr 2017 07:36:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Apr 2017 07:36:49 +0000 (UTC) Cc: Emacs developers To: Kaushal Modi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 12 09:36:44 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyCpY-0008LL-EZ for ged-emacs-devel@m.gmane.org; Wed, 12 Apr 2017 09:36:44 +0200 Original-Received: from localhost ([::1]:42648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyCpc-0000zN-OL for ged-emacs-devel@m.gmane.org; Wed, 12 Apr 2017 03:36:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyCor-0000zE-Vp for emacs-devel@gnu.org; Wed, 12 Apr 2017 03:36:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyCoq-00040T-7X for emacs-devel@gnu.org; Wed, 12 Apr 2017 03:36:01 -0400 Original-Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]:35620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cyCoq-0003ys-1L for emacs-devel@gnu.org; Wed, 12 Apr 2017 03:36:00 -0400 Original-Received: by mail-qk0-x22f.google.com with SMTP id f133so16457774qke.2 for ; Wed, 12 Apr 2017 00:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7JrRsljP0uLCQ2okSPG52dqLNPAcIvVjpy2+jjJRBy0=; b=ARBtoD5E4m7QxlY0oP12DgR+Cfweif3ep1KNiKdQl5uy0W2TUQYfl7WH2H5GGxrQOi iYBqnOyRW5fMPK3F/5fRV0O513DpL/uO7pZdf0h3dEr5ad7/3lffCGOopdmbpfMhb54b rYD96WzMMlhNopzzamQ/LVJ5C1zrrEDzJXBQ0F+nGtTT6a+N6gVHuQYHu9B8BtpCj9uU /B3nwlDPCrD79XyJH94dAw2x5HNkCSliq7mQEX1uF3tG7j0wYM3FXPO/Z4+CMq0LtOMm Psp2TwnIUaxwUQT1jgwFB/mnAiQ+RWw+ByTRjO86Txa+mwmC+zA5GwqOk0DGdfiDddCX KcMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7JrRsljP0uLCQ2okSPG52dqLNPAcIvVjpy2+jjJRBy0=; b=cNmu2DNHx/Rm04tyCfNHnSoeOE8dNv7EROV2f7DXT4+aRC0YC7jIPtiF2U8HBpdXwV BsnrtDKVlPkZ2HeR2Zs6dUR72601+V0/cP/2RtICdGgTqP2XcaphMOFixc7v6InY+7o+ 8PSeKUpFq1jA+RW734gdXRYdmzRwqfvbCxAH8RAedWglhU9ONF4X9y9DDbdYYCU3SSUk kExxH5glRH0E0LQhdnF3LtBwEClen9Rnq4CCuKNqiFdKCeIHs05zcYEezv6a/+zZ1XBY RLXI36STipcaBmvjTZlAMbQNNHF/tD2GOAQI772q4onnQAkdNW4ECrVL9917+QYUH1KX pe9Q== X-Gm-Message-State: AFeK/H2AjeKg47DLef7hXf5t6mtwcH6HEUwWwEr4yeLe+S/xQR/WJW2E00ZymAOzZMUd+mMJUkOr/wqdCgwH4A== X-Received: by 10.55.207.208 with SMTP id v77mr57597385qkl.189.1491982557977; Wed, 12 Apr 2017 00:35:57 -0700 (PDT) Original-Received: by 10.200.58.197 with HTTP; Wed, 12 Apr 2017 00:35:57 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:213894 Archived-At: --001a1145a5e661267c054cf3424e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks for the update. Tim On 12 April 2017 at 08:37, Kaushal Modi wrote: > Hi Tim, > > I just discovered a bug in this advice.. I needed to fix the order of > packages in the new-ret list that is returned. The bug was that the order > of pkgs in new-ret was flipped compared to that in orig-ret.. so I needed > to flip it back using reverse. > > Here is the fixed function: > > ;; http://emacs.stackexchange.com/a/26513/115 > (defun modi/package-dependency-check-ignore (orig-ret) > "Remove the `black listed packages' from ORIG-RET. > > Packages listed in the let-bound `pkg-black-list' will not be > auto-installed > even if they are found as dependencies. > > It is known that this advice is not effective when installed packages > asynchronously using `paradox'. Below is effective on synchronous > package installations." > (let ((pkg-black-list '(org)) > new-ret > pkg-name) > (dolist (pkg-struct orig-ret) > (setq pkg-name (package-desc-name pkg-struct)) > (if (member pkg-name pkg-black-list) > (message (concat "Package `%s' will not be installed. " > "See `modi/package-dependency-check-ignore'.") > pkg-name) > (push pkg-struct new-ret))) > ;; Tue Apr 11 17:48:16 EDT 2017 - kmodi > ;; It's *very* critical that the order of packages stays the same in > NEW-RET > ;; as in ORIG-RET. The `push' command flips the order, so use `revers= e' > ;; to flip the order back to the original. > ;; Without this step, you will get errors like below when installin= g > ;; packages with dependencies: > ;; Debugger entered--Lisp error: (error "Unable to activate package > =E2=80=98nim-mode=E2=80=99. > ;; Required package =E2=80=98flycheck-28=E2=80=99 is unavailable") > (setq new-ret (reverse new-ret)) > new-ret)) > (advice-add 'package-compute-transaction :filter-return > #'modi/package-dependency-check-ignore) > > On Sat, Mar 4, 2017 at 6:44 PM Tim Cross wrote: > >> Nice and useful idea. >> >> thanks >> >> On 5 March 2017 at 09:46, Kaushal Modi wrote: >> >> I have this in my config which works very well. I use this just for org >> :) I build org from its master branch, so I do not want the dependency >> check to auto-install older versions from Elpa. >> >> ;; http://emacs.stackexchange.com/a/26513/115 >> (defun modi/package-dependency-check-ignore (orig-ret) >> "Remove the `black listed packages' from ORIG-RET. >> Packages listed in the let-bound `pkg-black-list' will not be >> auto-installed >> even if they are found as dependencies. >> It is known that this advice is not effective when installed packages >> asynchronously using `paradox'. Below is effective on synchronous >> package installations." >> (let ((pkg-black-list '(org)) >> new-ret >> pkg-name) >> (dolist (pkg-struct orig-ret) >> (setq pkg-name (package-desc-name pkg-struct)) >> (if (member pkg-name pkg-black-list) >> (message (concat "Package `%s' will not be installed. " >> "See `modi/package-dependency-check-ignore'."= ) >> pkg-name) >> ;; (message "Package to be installed: %s" pkg-name) >> (push pkg-struct new-ret))) >> new-ret)) >> (advice-add 'package-compute-transaction :filter-return >> #'modi/package-dependency-check-ignore) >> >> https://github.com/kaushalmodi/.emacs.d/blob/master/setup-packages.el >> >> On Thu, Mar 2, 2017 at 7:41 PM Tim Cross wrote: >> >> Is there a way to specify alternative dependencies in a package? >> >> Situation: installing a package is resulting in an additional package >> being installed even though the dependencies for the package have alread= y >> been satisfied by another package. This results in two packages being >> installed which provide overlapping functionality. >> >> Example. I have installed org-plus-contrib. I then install elfeed-org, >> which has a dependency on org. This results in the org package being >> installed, but org is already installed as part of the org-plus-contrib >> package. >> >> I'm trying to work out if this is a problem with how dependencies are >> defined in the elfeed-org package or is it a problem with how >> org-plus-conrib is specifying what dependency it satisfies? Need to know= in >> order to determine where this issue needs to be logged. >> >> -- >> >> Kaushal Modi >> >> >> >> >> -- >> regards, >> >> Tim >> >> -- >> Tim Cross >> >> -- > > Kaushal Modi > --=20 regards, Tim -- Tim Cross --001a1145a5e661267c054cf3424e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks for the update.

Tim
<= div class=3D"gmail_extra">
On 12 April 2017 a= t 08:37, Kaushal Modi <kaushal.modi@gmail.com> wrote:
Hi Tim,

I j= ust discovered a bug in this advice.. I needed to fix the order of packages= in the new-ret list that is returned. The bug was that the order of pkgs i= n new-ret was flipped compared to that in orig-ret.. so I needed to flip it= back using reverse.

Here is the fixed function:

<= div>
(def= un modi/package-dependency-check-ignore (orig-ret)
=C2=A0 "Remove the `black listed packages' = from ORIG-RET.

<= div>Packages listed in the let-bound `pkg-black-li= st' will not be auto-installed
even if they are found as dependencies.

It is known that th= is advice is not effective when installed packages
asynchronously using `paradox'. Below is effective on= synchronous
package installation= s."
=C2=A0 (let ((pkg-black-= list '(org))
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 new-ret
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 pkg-name)
=C2= =A0 =C2=A0 (dolist (pkg-struct orig-ret)
=C2=A0 =C2=A0 =C2=A0 (setq pkg-name (package-desc-name pkg-stru= ct))
=C2=A0 =C2=A0 =C2=A0 (if (me= mber pkg-name pkg-black-list)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message (concat "Package `%s' wil= l not be installed. "
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0"See `modi/package-dependency-check-ignore'.= ")
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pkg-name)
<= div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (push pkg-struct n= ew-ret)))
=C2=A0 =C2=A0 ;; Tu= e Apr 11 17:48:16 EDT 2017 - kmodi
=C2=A0 =C2=A0 ;; It's *very* critical that the order of packages stay= s the same in NEW-RET
=C2=A0 =C2= =A0 ;; as in ORIG-RET. The `push' command flips the order, so use `reve= rse'
=C2=A0 =C2=A0 ;; to flip= the order back to the original.
= =C2=A0 =C2=A0 ;; =C2=A0 Without this step, you will get errors like below w= hen installing
=C2=A0 =C2=A0 ;; p= ackages with dependencies:
=C2=A0= =C2=A0 ;; =C2=A0 Debugger entered--Lisp error: (error "Unable to acti= vate package =E2=80=98nim-mode=E2=80=99.
=C2=A0 =C2=A0 ;; =C2=A0 Required package =E2=80=98flycheck-28=E2=80= =99 is unavailable")
=C2=A0 = =C2=A0 (setq new-ret (reverse new-ret))
=C2=A0 =C2=A0 new-ret))
= (advice-add 'package-compute-transaction :filt= er-return #'modi/package-dependency-check-ignore)
=

On Sat, Mar 4, 2017 at 6:44 PM Tim Cross <theophilusx@gmail.co= m> wrote:
Nice and useful idea.=C2=A0

thanks

On 5 March 2017 at 09:46, Kaushal Modi <kaushal.modi@gmail.= com> wrote:
I have this in my config which work= s very well. I use this just for org :) I build org from its master branch,= so I do not want the dependency check to auto-install older versions from = Elpa.

(defun modi/package-dependency-chec= k-ignore (orig-ret)
=C2=A0 "Remove the `black listed packages' from ORIG-RET.
Packages listed in the let-boun= d `pkg-black-list' will not be auto-installed
even if they are found as dependencies.
It is known that this advice is n= ot effective when installed packages
asynchronously using `paradox'. Below is effective on sync= hronous
package installa= tions."
=C2=A0 (let= ((pkg-black-list '(org))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 new-ret
=C2=A0 =C2=A0 =C2=A0 =C2=A0 pkg-name)
=C2=A0 =C2=A0 (dolist (pkg-struct orig-ret)=
=C2=A0 =C2=A0 =C2=A0 (s= etq pkg-name (package-desc-name pkg-struct))
=C2=A0 =C2=A0 =C2=A0 (if (member pkg-name pkg-black-li= st)
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 (message (concat "Package `%s' will not be installe= d. "
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0"See `modi/package-dependency-check-ignore'.")=
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pkg-name)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; (message= "Package to be installed: %s" pkg-name)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (push pkg-struct new= -ret)))
=C2=A0 =C2=A0 ne= w-ret))
(advice-add '= ;package-compute-transaction :filter-return #'modi/package-dependency-<= wbr>check-ignore)


On Thu, Mar 2, 2017 at 7:= 41 PM Tim Cross <theophilusx@gmail.com> = wrote:
Is there a way to specify alternative dependenci= es in a package?

Situation: installing a package is resulting in an additional package= being installed even though the dependencies for the package have already = been satisfied by another package. This results in two packages being insta= lled which provide overlapping functionality.=C2=A0

Example. I have installed or= g-plus-contrib. I then install elfeed-org, which has a dependency on org. T= his results in the org package being installed, but org is already installe= d as part of the org-plus-contrib package.=C2=A0

<= div class=3D"m_2492823271867102983m_2181391693861152692m_-83180272620553222= 89gmail_msg m_2492823271867102983gmail_msg">I'm trying to work out if t= his is a problem with how dependencies are defined in the elfeed-org packag= e or is it a problem with how org-plus-conrib is specifying what dependency= it satisfies? Need to know in order to determine where this issue needs to= be logged.
--

Kaushal Modi




--=
regards,

Tim<= /div>

--=
Tim Cross

--

Kaushal Modi




--
regards,

Tim

--
Tim Cross

--001a1145a5e661267c054cf3424e--