all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Petkov <ivanppetkov@gmail.com>
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: guix-devel@gnu.org
Subject: Re: Current state of cargo-build-system
Date: Fri, 25 Jan 2019 15:57:03 -0800	[thread overview]
Message-ID: <2E175E19-40C4-4954-A282-EE31C77D7A5D@gmail.com> (raw)
In-Reply-To: <20190123181000.6c5fc532@scratchpost.org>

Thank you all for the responses!

> Cycles.  Also, often Cargo.lock specifies exact versions of dependencies (in
> programs, at least)

Yes, this is pretty much the main issue I immediately hit when doing a naive
crate import, more on this further down.

> First, we'd have to find out what kind of things Cargo can build and how to
> detect it.

Cargo supports a subcommand called `metadata` which essentially dumps its
manifest in JSON format, which will include build scripts, binary outputs, etc.
I think this should give us enough information to figure out which packages have
targets to install (right now we try to install every single package which
doesn't work for libraries) among other things.

> After that, we can decide whether to compile libraries or just ship them as
> source (right now, we do the latter pretty often - almost everything in Guix
> Rust library packages ends up in the "src" output).
>  
> Getting the unit tests to run often requires breaking many cycles, so maybe
> skip that at first.

I tried breaking up cycles by hand for a couple days on another sample import,
but its just too tedious and error prone, especially when cycles span multiple
packages...  I'd really like for us to solve the issue altogether if possible.

Cargo (thankfully) checks and rejects an true dependency cycles, but its
notion of dev-dependencies (deps only used for running tests) is what throws
guix in for a loop. Dev-depencency cycles are permitted by cargo because it
builds the target crate independently, then it builds any extra dependencies
which may or may not depend on it, and then it builds a test crate which depends
on both. There are potentially legitimate cases which trigger this scenario
(such as testing your own public API through an upstream crate, see proc-macro2
for an example), or are just exacerbated by optional dependencies.

I think depending on the "src" output of crates is the right way to get things
started (this is what cargo essentially does anyway, it figures out what crates
are in the dependency, pulls their sources down and builds them), we can always
optimize this in the future to avoid recursively rebuilding crates over and
over.

However, it appears that guix still insists on building the entire package even
if we only depend on the "src" output. Is it possible to lazily build packages
based on the type of dependency? Is this something the build system can finagle,
or is this an inherent limitation to guix?

--Ivan

  reply	other threads:[~2019-01-25 23:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21  0:11 Current state of cargo-build-system Ivan Petkov
2019-01-23 10:50 ` Ludovic Courtès
2019-01-23 11:46   ` ng0
2019-01-23 17:10 ` Danny Milosavljevic
2019-01-25 23:57   ` Ivan Petkov [this message]
2019-01-27 23:13     ` Ivan Petkov
2019-01-28  8:44     ` Ricardo Wurmus
2019-01-28 16:23       ` Ivan Petkov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2E175E19-40C4-4954-A282-EE31C77D7A5D@gmail.com \
    --to=ivanppetkov@gmail.com \
    --cc=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.