From: Efraim Flashner <efraim@flashner.co.il>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
Cc: 46399@debbugs.gnu.org
Subject: [bug#46399] [PATCH] build-system/cargo: Propagate crates across builds.
Date: Mon, 12 Apr 2021 09:40:17 +0300 [thread overview]
Message-ID: <YHPrUS/hT3Kp2hcQ@3900XT> (raw)
In-Reply-To: <20210411151052.ckjjpbrpqgfp43tl@pelzflorian.localdomain>
[-- Attachment #1: Type: text/plain, Size: 4776 bytes --]
On Sun, Apr 11, 2021 at 05:11:21PM +0200, pelzflorian (Florian Pelz) wrote:
> Hello Efraim!
>
> Thank you for improving Rust development with Guix. I have a question
> about this change to doc/guix.texi when translating. Sorry for
> noticing so late just before the string freeze.
>
> On Tue, Feb 09, 2021 at 12:58:43PM +0200, Efraim Flashner wrote:
> > diff --git a/doc/guix.texi b/doc/guix.texi
> > index 7d18703283..0d153a1470 100644
> > --- a/doc/guix.texi
> > +++ b/doc/guix.texi
> > […]
> > @@ -7437,8 +7437,10 @@ supports builds of packages using Cargo, the build tool of the
> > It adds @code{rustc} and @code{cargo} to the set of inputs.
> > A different Rust package can be specified with the @code{#:rust} parameter.
> >
> > -Regular cargo dependencies should be added to the package definition via the
> > -@code{#:cargo-inputs} parameter as a list of name and spec pairs, where the
> > +Regular cargo dependencies should be added to the package definition similarly
> > +to other packages; those needed only at build time to native-inputs, others to
> > +inputs. If you need to add source-only crates then you should add them to via
> > +the @code{#:cargo-inputs} parameter as a list of name and spec pairs, where the
> > spec can be a package or a source definition. Note that the spec must
> > evaluate to a path to a gzipped tarball which includes a @code{Cargo.toml}
> > file at its root, or it will be ignored. Similarly, cargo dev-dependencies
>
> I have no experience in Rust. Do I understand correctly that
> source-only crates among the inputs should be added both to inputs and
> to #:cargo-inputs? Is the
>
> > +inputs. If you need to add source-only crates then you should add them to via
>
> a typo which should read “add them too” instead of “add them to”?
I went back and refreshed myself with what I wrote there. source-only
crates should be added to both regular inputs and to #:cargo-inputs.
Actually converting the ~1000 rust packages to actually make good use of
the changes will allow us to drop nearly all the #:cargo-inputs and just
use regular inputs, but until then we still need the propagated source
magic that comes from #:cargo-inputs.
Yes, definitely a typo, it should be "add them too".
> I look at the subsequent change
> f35ab79e033aa8e4955e9c9100c74ecbb3ce4d0b to rust-wayland-commons
>
> > diff --git a/gnu/packages/crates-graphics.scm b/gnu/packages/crates-graphics.scm
> > index d67e9dc02f..7dde00ffdb 100644
> > --- a/gnu/packages/crates-graphics.scm
> > +++ b/gnu/packages/crates-graphics.scm
> > @@ -2415,8 +2415,11 @@ the wayland protocol, client side.")
> > (arguments
> > - `(#:skip-build? #t
> > - #:cargo-inputs
> > + `(#:cargo-inputs
> > (("rust-nix" ,rust-nix-0.18)
> > ("rust-once-cell" ,rust-once-cell-1)
> > - ("rust-smallvec" ,rust-smallvec-1)
> > - ("rust-wayland-sys" ,rust-wayland-sys-0.28))))
> > + ("rust-smallvec" ,rust-smallvec-1))))
> > + (inputs
> > + `(("rust-nix" ,rust-nix-0.18)
> > + ("rust-once-cell" ,rust-once-cell-1)
> > + ("rust-smallvec" ,rust-smallvec-1)
> > + ("rust-wayland-sys" ,rust-wayland-sys-0.28)))
> > (home-page "https://github.com/smithay/wayland-rs")
>
> and do not understand why rust-wayland-sys is only part of inputs but
> rust-once-cell is also among the cargo-inputs. Also the inputs are
> empty for older versions of rust-wayland-commons.
#:cargo-inputs are "magic" in that they propagate their own #:cargo-inputs
to future builds. The changes to the cargo-build-system mimic this so we
can use regular inputs and not #:cargo-inputs. rust-wayland-sys-0.28 has
enough of its dependencies converted that it can be used as just an
input but rust-once-cell-1 hasn't yet so it still needs to be in
#:cargo-inputs. As far as the other versions of rust-wayland-commons, I
started by focusing on alacritty so we could remove some of the build
phases and move them to the crates which actually needed patching.
> Could you clarify what is written in the doc/guix.texi?
>
> Regards,
> Florian
I think for now the best option is to add the rust inputs of all types
to both inputs and #:cargo-inputs (or native-inputs and
#:cargo-development-inputs) and then remove them from #:cargo-inputs
when it's possible to do so. Ultimately Someone™ should revive the
wip-rust branch and convert all the crates over in one go and adjust the
importer and manual.
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-04-13 11:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-09 10:58 [bug#46399] [PATCH] build-system/cargo: Propagate crates across builds Efraim Flashner
[not found] ` <handler.46399.B.16128684293899.ack@debbugs.gnu.org>
2021-03-14 17:59 ` bug#46399: Acknowledgement ([PATCH] build-system/cargo: Propagate crates across builds.) Efraim Flashner
2021-04-11 15:11 ` [bug#46399] [PATCH] build-system/cargo: Propagate crates across builds pelzflorian (Florian Pelz)
2021-04-12 6:40 ` Efraim Flashner [this message]
2021-04-13 12:31 ` pelzflorian (Florian Pelz)
2021-04-13 17:49 ` Leo Famulari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YHPrUS/hT3Kp2hcQ@3900XT \
--to=efraim@flashner.co.il \
--cc=46399@debbugs.gnu.org \
--cc=pelzflorian@pelzflorian.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).