From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Channel dependencies Date: Mon, 15 Oct 2018 11:29:18 +0200 Message-ID: <877eijk175.fsf@gnu.org> References: <877eimnxpq.fsf@mdc-berlin.de> <87k1ml8e7r.fsf@gmail.com> <871s8soo26.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBzCA-0003EN-Vk for guix-devel@gnu.org; Mon, 15 Oct 2018 05:29:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBzC9-0006Wp-R4 for guix-devel@gnu.org; Mon, 15 Oct 2018 05:29:50 -0400 In-Reply-To: <871s8soo26.fsf@elephly.net> (Ricardo Wurmus's message of "Sun, 14 Oct 2018 11:49:40 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel@gnu.org, Ricardo Wurmus Hello, Ricardo Wurmus skribis: >>> (define (latest-channel-instances store channels) >>> "Return a list of channel instances corresponding to the latest chec= kouts of >>> -CHANNELS." >>> - (map (lambda (channel) >>> - (format (current-error-port) >>> - (G_ "Updating channel '~a' from Git repository at '~a= '...~%") >>> - (channel-name channel) >>> - (channel-url channel)) >>> - (let-values (((checkout commit) >>> - (latest-repository-commit store (channel-url ch= annel) >>> - #:ref (channel-refere= nce >>> - channel)))) >>> - (channel-instance channel commit checkout))) >>> - channels)) >>> +CHANNELS and the channels on which they depend." >>> + (append-map (lambda (channel) >>> + (format (current-error-port) >>> + (G_ "Updating channel '~a' from Git repository= at '~a'...~%") >>> + (channel-name channel) >>> + (channel-url channel)) >>> + (let-values (((checkout commit) >>> + (latest-repository-commit store (channel= -url channel) >>> + #:ref (channel= -reference >>> + channel= )))) >>> + (let ((instance (channel-instance channel commit che= ckout))) >>> + (cons instance (latest-channel-instances >>> + store >>> + (channel-instance-dependencies ins= tance)))))) >>> + channels)) >> >> What happens if the dependency list contains duplicate channels? This >> might happen if two unrelated channels mutually depend upon a third >> channel. >> >> What happens if the dependency list contains two channels that differ >> only in their branch (or commit), and are the same in every other way? >> This might happen if two unrelated channels mutually depend upon two >> different versions of the same third channel. We should error out in this case because at run time, there can be only one Guile module with a given name. Thus, conflicting dependencies cannot be honored. (Not like Node.js, for better or worse. ;-)) > I was going to write an email about this just now. This is indeed a > problem with this naive implementation. > > For reproducibility a user may want to pin all channels to a certain > commit, but channels that are dependencies are exempt from that > mechanism as they are added to the list of channels to be instantiated > during the run of =E2=80=9Cguix pull=E2=80=9D. > > It should be possible to pin *all* channels, even if they are > dependencies of other channels. One way is to treat all channels and > their dependencies as a unique set where duplicates are replaced with > the most specific description (e.g. those specifying a commit). This > way users could fully specify dependencies, which would then be used > instead of the channel=E2=80=99s declared dependency. Of course it=E2=80=99s easier to pin all channels when they are directly expressed in ~/.config/guix/channels.scm. Say, I need channel A, which depends on B. What we could do is that if B is already in ~/.config/guix/channels.scm, then we take this particular B; if it=E2=80=99s not there, we take the late= st version. In terms of the dependency code, it means that dependencies found in .guix-channels file are added if and only if they are not already present in the user-provided channel list. Does that make sense? Thanks! Ludo=E2=80=99.