From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:35454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSo7m-000193-HM for guix-patches@gnu.org; Mon, 20 May 2019 15:39:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSo7k-0000gn-EM for guix-patches@gnu.org; Mon, 20 May 2019 15:39:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSo7i-0000f5-Np for guix-patches@gnu.org; Mon, 20 May 2019 15:39:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hSo7i-0007kM-Ey for guix-patches@gnu.org; Mon, 20 May 2019 15:39:02 -0400 Subject: [bug#35318] [PATCH] Update cargo-build-system to expand package inputs Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87ftpsnhal.fsf@gnu.org> <2C03880B-F90E-4949-9637-DC918B6D40A0@gmail.com> <074E4899-C4FF-4A76-8E97-093378D2F8D5@gmail.com> <87pnojvqdu.fsf@gnu.org> <6A0A0108-A722-4D73-85B7-E61AB8230026@gmail.com> Date: Mon, 20 May 2019 21:38:36 +0200 In-Reply-To: <6A0A0108-A722-4D73-85B7-E61AB8230026@gmail.com> (Ivan Petkov's message of "Sun, 19 May 2019 18:00:01 -0700") Message-ID: <87pnocq5kz.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ivan Petkov Cc: 35318@debbugs.gnu.org, Chris Marusich Hi Ivan! Ivan Petkov skribis: > Please let me know if anything is unclear, I=E2=80=99m happy to elaborate= if needed! I=E2=80=99ll only comment superficially because I haven=E2=80=99t followed = the rest of the discussion and I know too little about Rust; hopefully Danny and Chris can provide feedback. > From 5457f60036ce1354b4b89b9c3c423cca14e3a777 Mon Sep 17 00:00:00 2001 > From: Ivan Petkov > Date: Tue, 16 Apr 2019 03:37:44 -0700 > Subject: [PATCH 1/8] build-system/cargo: expand transitive crate sources > > * guix/build/cargo: (package-cargo-deps): Add it. > (package-cargo-dev-deps): Add it. > (cargo-transitive-deps): Add it. > (expand-crate-sources): Add it. > (lower): New cargo-deps nd cargo-dev-deps keywords. > Use expand-crate-sources. > (private-keywords): Add new keywords. [...] > +(define (package-cargo-deps p) > + (apply > + (lambda* (#:key (cargo-deps '()) #:allow-other-keys) > + cargo-deps) > + (package-arguments p))) It=E2=80=99s surprising style. It seems redundant with the =E2=80=98inputs= =E2=80=99 field, but IIUC, the main difference here is that you can simply name dependencies, even if there=E2=80=99s no Guix package for it, right? > +(define (package-cargo-dev-deps p) > + (apply > + (lambda* (#:key (cargo-dev-deps '()) #:allow-other-keys) > + cargo-dev-deps) > + (package-arguments p))) As a rule of thumb, please avoid abbreviations in identifiers (info "(guix) Coding Style"). So that would be =E2=80=98package-development-dependencies=E2=80=99 or something like that. > +(define (crate-transitive-deps inputs) > + "Return the closure of INPUTS when considering the 'cargo-deps' and > +'cargod-dev-deps' edges. Omit duplicate inputs, except for those > +already present in INPUTS itself. > + > +This is implemented as a breadth-first traversal such that INPUTS is > +preserved, and only duplicate extracted inputs are removed. > + > +Forked from ((guix packages) transitive-inputs) since this extraction > +uses slightly different rules compared to the rest of Guix (i.e. we > +do not extract the conventional inputs)." Perhaps call it =E2=80=98crate-closure=E2=80=99? > +(define (expand-crate-sources cargo-deps cargo-dev-deps) > + "Extract all transitive sources for CARGO-DEPS and CARGO-DEV-DEPS alon= g their > +'cargo-deps' edges. Maybe s/cargo-deps/inputs/ and s/cargo-dev-deps/development-inputs/? I=E2=80=99d prefer to stick to the same terminology as in the rest of the c= ode if we=E2=80=99re talking about the same sort of input lists. That=E2=80=99s it. :-) Thank you for improving Rust support! Ludo=E2=80=99.