Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a proper eclass for crates #195

Closed
suhr opened this issue Jul 10, 2016 · 13 comments
Closed

Create a proper eclass for crates #195

suhr opened this issue Jul 10, 2016 · 13 comments

Comments

@suhr
Copy link
Contributor

suhr commented Jul 10, 2016

Prototype: https://github.com/suhr/badumz/blob/master/eclass/cargo-utils.eclass
Also relevant: https://github.com/gentoo/gentoo/blob/master/eclass/cargo.eclass

Unresolved questions:

  • Should we download sources somewhere to distfiles
  • How to combine cargo fetch with other unpacks (git, archives)

cast @cardoe

@cardoe
Copy link
Contributor

cardoe commented Jul 10, 2016

I'm working towards this. I'm actually tackling this on Yocto first. You can see an example recipe here: starlab-io/meta-rust@112d40a And you can see the rest of the commits here: https://github.com/starlab-io/meta-rust/commits/crate-fetch

Its not totally done yet. But the main tree eclass does fetch crates to distfiles as name-version.crate

@cardoe
Copy link
Contributor

cardoe commented Jul 10, 2016

Oh and we can't use cargo fetch until Gentoo adds a src_fetch phase.

@cardoe
Copy link
Contributor

cardoe commented Jul 10, 2016

What files does cargo install create? Does it generate additional metadata?

@suhr
Copy link
Contributor Author

suhr commented Jul 10, 2016

Great!

There's some problem though. Looks like it lists all dependencies in SRC_URI. But a list of all dependencies can be quite big, so ebuilds become hard to create and edit.

Does it generate additional metadata?

Yep, it creates $CARGO_HOME/.crates.toml. We don't need it because removing doesn't require cargo.

@cardoe
Copy link
Contributor

cardoe commented Jul 11, 2016

I don't disagree that the dependencies become quite big. But the only way to get things in tree is that we need to let the package manager download the files until src_fetch() gets added in an EAPI.

I don't think ebuilds that build cargo packages should be made by hand. They should be made by a tool. see https://github.com/cardoe/cargo-ebuild that I'm working on to generate ebuilds.

You can see an example ebuild for rustfmt here: https://github.com/cardoe/gentoo/tree/rustfmt

@gentoo90
Copy link
Contributor

Maybe local registries from rust-lang/cargo#2361 could be useful here

@cardoe
Copy link
Contributor

cardoe commented Jul 15, 2016

@gentoo90 We're working on this in rust-lang/cargo#2857

@cardoe
Copy link
Contributor

cardoe commented Nov 25, 2016

Now that we have the necessary versions in the tree, I took a swag at doing this. Please checkout https://github.com/cardoe/gentoo/tree/rustfmt

@cardoe
Copy link
Contributor

cardoe commented Nov 25, 2016

Pretty sure I broke the build of cargo with this change so I'll have to work on it some more.

@cardoe
Copy link
Contributor

cardoe commented Nov 26, 2016

Well rustfmt installs properly now. Now to sync up the ebuild with what I'm generating with https://github.com/cardoe/cargo-ebuild

@cardoe
Copy link
Contributor

cardoe commented Nov 26, 2016

cargo-ebuild 0.1.2 should produce ebuilds for things published on crates.io that work with these changes.

@cardoe
Copy link
Contributor

cardoe commented Nov 26, 2016

Alright. I believe everything is updated. @gentoo90 if you want to take a peek and tell me what you think of my branch? I didn't notice you had done the work already until this morning and could have probably saved myself some time using your changes.

@gibix
Copy link
Contributor

gibix commented May 14, 2018

this can be closed

@cnd cnd closed this as completed May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants