From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: Channel dependencies Date: Sat, 13 Oct 2018 19:16:40 -0700 Message-ID: <87k1ml8e7r.fsf@gmail.com> References: <877eimnxpq.fsf@mdc-berlin.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBVxd-00047w-Io for guix-devel@gnu.org; Sat, 13 Oct 2018 22:16:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBVxc-0005oe-Jl for guix-devel@gnu.org; Sat, 13 Oct 2018 22:16:53 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:43942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gBVxc-0005oK-8v for guix-devel@gnu.org; Sat, 13 Oct 2018 22:16:52 -0400 Received: by mail-pf1-x429.google.com with SMTP id p24-v6so7976786pff.10 for ; Sat, 13 Oct 2018 19:16:51 -0700 (PDT) In-Reply-To: <877eimnxpq.fsf@mdc-berlin.de> (Ricardo Wurmus's message of "Sat, 13 Oct 2018 08:54:09 +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 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Ricardo, Ricardo Wurmus writes: > the attached patch allows channel authors to declare other channels as > dependencies of their own channel. > > [...] > > What do you think? It's very cool! > +(define (channel-instance-dependencies instance) > + "Return the list of channels that are declared as dependencies for the= given > +channel INSTANCE." > + (or (and=3D> (assoc-ref (channel-meta instance) 'dependencies) > + (lambda (dependencies) > + (map (lambda (item) > + (let ((get (lambda* (key #:optional default) > + (or (and=3D> (assoc-ref item key) car= ) default)))) Nitpick: to improve readability, is it possible to use pattern matching here instead of using procedures like "car"? > (define (latest-channel-instances store channels) > "Return a list of channel instances corresponding to the latest checko= uts 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 chan= nel) > - #:ref (channel-reference > - 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 a= t '~a'...~%") > + (channel-name channel) > + (channel-url channel)) > + (let-values (((checkout commit) > + (latest-repository-commit store (channel-u= rl channel) > + #:ref (channel-r= eference > + channel))= )) > + (let ((instance (channel-instance channel commit check= out))) > + (cons instance (latest-channel-instances > + store > + (channel-instance-dependencies insta= nce)))))) > + 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. > (define %self-build-file ;; The file containing code to build Guix. > This serves the same purpose as @@ -223,8 +259,21 @@ INSTANCES." > (lambda (instance) (if (eq? instance core-instance) (return core) > - (build-channel-instance instance > - (cons core dependencies)))) > + (match (channel-instance-dependencies instance) > + (() > + (build-channel-instance instance > + (cons core dependencies))) > + (channels > + (mlet %store-monad ((dependencies-derivation > + (latest-channel-derivation > + ;; %default-channels is used he= re to > + ;; ensure that the core channel= is > + ;; available for channels decla= red as > + ;; dependencies. > + (append channels %default-chann= els)))) > + (build-channel-instance instance > + (cons dependencies-derivati= on > + (cons core dependenci= es)))))))) I think we should clarify in the manual the fact that channel authors do not need to specify the core "guix" channel in their dependencies, since it is an implicit dependency of all non-core channels. Thank you for working on this! I'm catching up on developments over the last few months, and it's really exciting to see channels become a reality. =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlvCpwgACgkQ3UCaFdgi Rp1ghg/+JW609nWCmaOusX/ivyYa+l45+3eS7srpulmC6dwlfIwj8QDbYJphMfBq 4UOIsIeiaySScnpJOmgLFXKc20J/QNG32lNFxjeiwkedJRUu4J3gJE1WmyhKN616 J8BE9vdbE7HdD5tsIW7TycszXMwagc2RydU0Rk6WanME8OaRwbA98Vu/aRH7Me4g pbpIDZzt0ptPJ1hvfFEy8CaBat+6TwA0GA5v/5EHIiMsRLvQ9nVccwUbNLLp8cHq L9mMd3Kkbf/s9Z8P77M2WqlhCJT3ySke0vcdHiA/fpEQk/tlU/pUoTbjd3FQM6x8 7IDGVCA8MOFBYb21QSwuI4LvkGTagBjPrLaiaOGC2Vcr9ZIfuK+1uSSMWHRXQAjW 6jfpzhFpDREsaGxhOkqMTD7YL/CRWjDbLgCHfel5jtHFglFj00QZjBz5qcBC3xWR Jj4e2/24o3chzU2htPafyaQLzkrN5bkYAnB082VHJphvpFhtk3W3M6DAvxknfQNt t2uT8a63OdBt5TIDYTh9hz/2mfZepsJoZ0c/v3T8x32M82eqF4j/KSzpVRsBSL7g btArgvqJR8L6hEc8R4t2YbP/KL8adQNSPE7ZDD8cbpHSpV9AIaRsutYhUMlDd3dE 6lujP/hOS9fJ6o1MMMnZr+xpeFsFd3NgkRy1C6TCtexyZ1b9d1c= =669R -----END PGP SIGNATURE----- --=-=-=--