Re: rust: Crate Dependencies

2016-12-29 Thread ng0
David Craven  writes:

>> Same here for libc crate after the update, but I guess that's
>> because cargo is currently packaged and used from the bootstrap
>> rust, which is dated one version before the actual rustc you can
>> use now, so 0.13.0 cargo and 0.14.0 rustc.
>
> I submitted some experimental patches to the ML which fix this.

Thanks, I will try them out next week.

> Since you have I assume a web application that is written in rust, and
> you want to deploy it using guixsd, I think that vendoring the
> dependencies like the example cargo package is what you should do. The
> goal of using guixsd is fixing the deployment problem. If you vendor
> your dependencies and deploy your application like the example cargo
> package you should get an environment that is controlled 100% by your
> company. Would be awesome to see some real commercial webapps deployed
> using guixsd!

I don't really get the "vendoring" term, but I will when I look
at the cargo package and its source.
To give context to my packaging, it is for the current secushare
(see secushare.org or its .onion) prototype. This is not a web
application (I understand web application as something which runs
just in the browser), it's an extendable application using GNUnet
and PSYC2, more or less a social network (and more).

If I remember correctly, we do not bundle and everything which
might currently be bundled is because of rusts limitations in
some parts. And even then, this is nothing intended to be
packaged publicly at the present state ("prototype"), but what I
do work on this will get integrated into GuixSD (secushare+gnunet
live-system).
-- 
♥Ⓐ  ng0
PGP keys and more: https://n0is.noblogs.org/ http://ng0.chaosnet.org



Re: rust: Crate Dependencies

2016-12-29 Thread David Craven
> Same here for libc crate after the update, but I guess that's
> because cargo is currently packaged and used from the bootstrap
> rust, which is dated one version before the actual rustc you can
> use now, so 0.13.0 cargo and 0.14.0 rustc.

I submitted some experimental patches to the ML which fix this.

Since you have I assume a web application that is written in rust, and
you want to deploy it using guixsd, I think that vendoring the
dependencies like the example cargo package is what you should do. The
goal of using guixsd is fixing the deployment problem. If you vendor
your dependencies and deploy your application like the example cargo
package you should get an environment that is controlled 100% by your
company. Would be awesome to see some real commercial webapps deployed
using guixsd!



Re: rust: Crate Dependencies

2016-12-29 Thread ng0
Danny Milosavljevic  writes:

> Hi David,
>
> On Thu, 29 Dec 2016 11:49:19 +0100
> David Craven  wrote:
>
>> It matters very
>> much which versions of rustc and cargo are used
>
> I used the versions in your v2 patch. I also tried ng0's update which didn't 
> improve things.

Same here for libc crate after the update, but I guess that's
because cargo is currently packaged and used from the bootstrap
rust, which is dated one version before the actual rustc you can
use now, so 0.13.0 cargo and 0.14.0 rustc.
I hope packaging cargo on its own will add the support for
namespaces.

>
> How does rustc find the (Rust) dependencies when building a package in 
> cargo-build-system? There doesn't seem to be a RUST* or CARGO* environment 
> variable or anything when I do "guix environment rust-c-vec --fallback". 
> (Note that I picked rust-c-vec to fix first because it has only rust-libc as 
> dependency)
>
> I read that there are actual Rust binary libraries, seldomly used, and 
> everything-included-only-as-source otherwise. How do I specify which it is?
>
> Or is that not implemented yet?
>
> I tried specifying the latter as native-inputs - which doesn't seems to work 
> either...
>
>

-- 
♥Ⓐ  ng0
PGP keys and more: https://n0is.noblogs.org/ http://ng0.chaosnet.org



Re: rust: Crate Dependencies

2016-12-29 Thread David Craven
Hi Danny,

> How does rustc find the (Rust) dependencies when building a package in 
> cargo-build-system?

You should be able to override the default rust or cargo version by
passing #:rustc or/and #:cargo as arguments to the build-system. See
guix/build-system/cargo.scm.

> I read that there are actual Rust binary libraries, seldomly used, and 
> everything-included-only-as-source otherwise. How do I specify which it is?

By actual Rust binary library I assume you mean a library with a C ABI
that can be dynamically linked against, written in rust.

A library like that should or would contain a Cargo.lock file nailing
down all the crate versions required, making sure that the project can
be built using the same rustc and cargo versions.

With a Cargo.lock file present the only remaining issue is figuring
out whether it can be built with the rustc release or if it requires
features from beta/nightly.

I don't know a specific example of one, but I also read that it is
possible. I think that the cargo install should take care of
installing such a library, but I don't think it's implemented yet.

HTH!



Re: rust: Crate Dependencies

2016-12-29 Thread Danny Milosavljevic
Hi David,

On Thu, 29 Dec 2016 11:49:19 +0100
David Craven  wrote:

> It matters very
> much which versions of rustc and cargo are used

I used the versions in your v2 patch. I also tried ng0's update which didn't 
improve things.

How does rustc find the (Rust) dependencies when building a package in 
cargo-build-system? There doesn't seem to be a RUST* or CARGO* environment 
variable or anything when I do "guix environment rust-c-vec --fallback". (Note 
that I picked rust-c-vec to fix first because it has only rust-libc as 
dependency)

I read that there are actual Rust binary libraries, seldomly used, and 
everything-included-only-as-source otherwise. How do I specify which it is?

Or is that not implemented yet?

I tried specifying the latter as native-inputs - which doesn't seems to work 
either...



Re: rust: Crate Dependencies

2016-12-29 Thread David Craven
> What does the error message mean? How to fix it?

Hard to tell from that description. Using the recursive importer is
not supported - use at your own risk ;) There is a reason why it's not
in master... While Makefiles and the C standard are defined, the rust
language and the Cargo.toml files are a moving target. It matters very
much which versions of rustc and cargo are used, for a moderately
complex crate the output of the recursive importer is going to be
completely unusable.



rust: Crate Dependencies

2016-12-28 Thread Danny Milosavljevic
Hi,

I'm trying Rust out for a bit and for that I added some Crates. (using David's 
v2 patches as a base)

Right now I'm stuck at rust-c-vec which I tried to add myself. I get:

starting phase `unpack'
c_vec-1.1.0/.travis.yml
c_vec-1.1.0/Cargo.toml
c_vec-1.1.0/LICENSE-APACHE
c_vec-1.1.0/LICENSE-MIT
c_vec-1.1.0/README.md
c_vec-1.1.0/src/c_vec.rs
phase `unpack' succeeded after 0.0 seconds
starting phase `patch-usr-bin-file'
phase `patch-usr-bin-file' succeeded after 0.0 seconds
starting phase `patch-source-shebangs'
phase `patch-source-shebangs' succeeded after 0.0 seconds
starting phase `configure'
phase `configure' succeeded after 0.0 seconds
starting phase `patch-generated-file-shebangs'
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds
starting phase `build'
error: failed to load source for a dependency on `libc`

I tried it with the following package spec:

(define-public rust-c-vec
 (package
  (name "rust-c-vec")
  (version "1.1.0")
  (source
(origin
  (method url-fetch)
  (uri (crate-uri "c_vec" version))
  (file-name
(string-append name "-" version ".tar.gz"))
  (sha256
(base32
  "02gkicm59prlhpc2igkvl4gbmclzg6wmancscwdk3z93p04rjqhc"
  (build-system cargo-build-system)
  (inputs `(("rust-libc" ,rust-libc)))
  (home-page "FIXME") ; FIXME fixed manually. It said ()
  (synopsis "Structures to wrap C arrays")
  (description "Structures to wrap C arrays")
  (license (list license:asl2.0 license:expat

I attached a Guile module with some of the Crates I am adding...

What does the error message mean? How to fix it?
(define-module (wip rustmods)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix utils)
  #:use-module (guix build-system cargo)
  #:use-module (guix gexp)
  #:use-module (gnu packages)
  #:use-module (gnu packages rust)
  #:use-module (gnu packages pkg-config))

(define-public rust-bitflags
 (package
  (name "rust-bitflags")
  (version "0.7.0")
  (source
(origin
  (method url-fetch)
  (uri (crate-uri "bitflags" version))
  (file-name
(string-append name "-" version ".tar.gz"))
  (sha256
(base32
  "0v8hh6wdkpk9my8z8442g4hqrqf05h0qj53dsay6mv18lqvqklda"
  (build-system cargo-build-system)
  (home-page
"https://github.com/rust-lang/bitflags;)
  (synopsis
"A macro to generate structures which behave like bitflags.
")
  (description
"This package provides a macro to generate structures which behave like bitflags.
")
  (license (list license:expat license:asl2.0

(define-public rust-glib-sys
 (package
  (name "rust-glib-sys")
  (version "0.3.2")
  (source
(origin
  (method url-fetch)
  (uri (crate-uri "glib-sys" version))
  (file-name
(string-append name "-" version ".tar.gz"))
  (sha256
(base32
  "1cwjfhyvys3hyzfr326sp1spsnj5drf8p9zixgis233zk7gz45d3"
  (build-system cargo-build-system)
  (native-inputs
`(("rust-pkg-config" ,rust-pkg-config)))
  (inputs
`(("rust-bitflags" ,rust-bitflags)
  ("rust-libc" ,rust-libc)))
  (home-page "http://gtk-rs.org/;)
  (synopsis "FFI bindings to libglib-2.0")
  (description "FFI bindings to libglib-2.0")
  (license license:expat)))

(define-public rust-pkg-config
 (package
  (name "rust-pkg-config")
  (version "0.3.8")
  (source
(origin
  (method url-fetch)
  (uri (crate-uri "pkg-config" version))
  (file-name
(string-append name "-" version ".tar.gz"))
  (sha256
(base32
  "1ypj4nj2z9z27qg06v3g40jyhw685i3l2wi098d21bvyri781vlc"
  (build-system cargo-build-system)
  (home-page "https://github.com/alexcrichton/pkg-config-rs;) ; FIXME manually fixed; it said ()
  (synopsis
"A library to run the pkg-config system tool at build time in order to be used in
Cargo build scripts.
")
  (description
"This package provides a library to run the pkg-config system tool at build time in order to be used in
Cargo build scripts.
")
  (license (list license:expat license:asl2.0

(define-public rust-gobject-sys
 (package
  (name "rust-gobject-sys")
  (version "0.3.2")
  (source
(origin
  (method url-fetch)
  (uri (crate-uri "gobject-sys" version))
  (file-name
(string-append name "-" version ".tar.gz"))
  (sha256
(base32
  "13qy4hsh74351969mzc19sx29g1clmh58v75d87pfnsikqi6qdw8"
  (build-system cargo-build-system)
  (native-inputs
`(("rust-pkg-config" ,rust-pkg-config)))
  (inputs
`(("rust-bitflags" ,rust-bitflags)
  ("rust-glib-sys" ,rust-glib-sys)
  ("rust-libc" ,rust-libc)))
  (home-page "http://gtk-rs.org/;)
  (synopsis "FFI bindings to libgobject-2.0")
  (description "FFI bindings to libgobject-2.0")
  (license license:expat)))

(define-public rust-glib
 (package
  (name "rust-glib")
  (version "0.1.1")
  (source
(origin
  (method url-fetch)