From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:60749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTHMH-00069x-7R for guix-patches@gnu.org; Tue, 21 May 2019 22:52:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTHJP-0003VU-JU for guix-patches@gnu.org; Tue, 21 May 2019 22:49:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTHJP-0003Ux-Fb for guix-patches@gnu.org; Tue, 21 May 2019 22:49:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hTHJP-00072B-7K for guix-patches@gnu.org; Tue, 21 May 2019 22:49:03 -0400 Subject: [bug#35318] [PATCH] Update cargo-build-system to expand package inputs Resent-Message-ID: Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) From: Ivan Petkov In-Reply-To: <87pnocq5kz.fsf@gnu.org> Date: Tue, 21 May 2019 19:48:24 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <43DF2996-1DEA-40CD-92FC-B27433F63AE7@gmail.com> 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> <87pnocq5kz.fsf@gnu.org> 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35318@debbugs.gnu.org, Chris Marusich Hi Ludo! > On May 20, 2019, at 12:38 PM, Ludovic Court=C3=A8s = wrote: >=20 >> +(define (package-cargo-deps p) >> + (apply >> + (lambda* (#:key (cargo-deps '()) #:allow-other-keys) >> + cargo-deps) >> + (package-arguments p))) >=20 > 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? That=E2=80=99s one benefit, the other is that we=E2=80=99re defining our = own new semantics on the cargo-specific inputs here to be treated like propagated-inputs, = but without actually making the store install them when a Rust binary is = substituted. >> +(define (package-cargo-dev-deps p) >> + (apply >> + (lambda* (#:key (cargo-dev-deps '()) #:allow-other-keys) >> + cargo-dev-deps) >> + (package-arguments p))) >=20 > 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. Thanks for the tip, I=E2=80=99ll update these names.=20 Since the actual cargo documentation actually refers to = =E2=80=9Cdev-dependencies=E2=80=9D do you think it=E2=80=99s better to use =E2=80=9Ccargo-dev-dependencies=E2= =80=9D (for consistency that Rust programmers might be used to), or stick with = =E2=80=9Ccargo-development-dependencies=E2=80=9D (for Guix consistencies)? >> +(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)." >=20 > Perhaps call it =E2=80=98crate-closure=E2=80=99? Sure that works, I=E2=80=99ll rename this! >> +(define (expand-crate-sources cargo-deps cargo-dev-deps) >> + "Extract all transitive sources for CARGO-DEPS and CARGO-DEV-DEPS = along their >> +'cargo-deps' edges. >=20 > Maybe s/cargo-deps/inputs/ and s/cargo-dev-deps/development-inputs/? >=20 > I=E2=80=99d prefer to stick to the same terminology as in the rest of = the code > if we=E2=80=99re talking about the same sort of input lists. I can rename this as well. >=20 > That=E2=80=99s it. :-) >=20 > Thank you for improving Rust support! Happy to help :) =E2=80=94Ivan=