View previous topic :: View next topic |
Author |
Message |
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Sun Apr 18, 2021 10:02 am Post subject: Creating rust packages drives me crazy. |
|
|
I am trying to create a package for https://github.com/PirateNetwork/piratepaperwallet
To build this, I need to patch Cargo.toml files and calculate dependencies manually and record the manually calculated dependencies in my ebuild file.
Creating net-p2p/piratewallet-lite::crocket-overlay was a pain in the ass.
Why is it so difficult to create rust packages? Are pirate chain programs exceptions? Or, is it generally frustrating across most rust programs? |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30917 Location: here
|
Posted: Sun Apr 18, 2021 10:14 am Post subject: |
|
|
You can try to use
Code: | * dev-util/cargo-ebuild
Available versions: ~0.2.0^m ~0.3.0^m ~0.3.1^m {debug}
Homepage: https://github.com/cardoe/cargo-ebuild
Description: Generates an ebuild for a package using the in-tree eclasses. |
_________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21635
|
Posted: Sun Apr 18, 2021 4:06 pm Post subject: |
|
|
Rust, like several languages before it, tried to reimplement package management as a language feature. This is generally a bad idea, and especially so when trying to integrate with an existing package manager, such as rpm, apt, or Portage. Having looked at ebuilds for other rust-based projects, it is my opinion that creating packages for Rust projects is generally tedious. |
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Mon Apr 19, 2021 11:46 am Post subject: |
|
|
I created net-p2p/piratepaperwallet::crocket-overlay... I got the hang of creating rust packages... |
|
Back to top |
|
|
mustafasalih1993 n00b
Joined: 09 Feb 2021 Posts: 38
|
Posted: Mon Apr 19, 2021 5:32 pm Post subject: |
|
|
addition to fedeliallalinea's reply
if you want to manually create the ebuild without using a tool, you can get the dependencies with the following command
Code: | cargo tree --all-features --prefix none |
|
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Tue Apr 20, 2021 4:17 am Post subject: |
|
|
mustafasalih1993 wrote: | addition to fedeliallalinea's reply
if you want to manually create the ebuild without using a tool, you can get the dependencies with the following command
Code: | cargo tree --all-features --prefix none |
|
That command looks cool.
Code: | cargo tree --all-features --prefix none | sed -e 's/ [(][*][)]//' | sort | uniq |
shows me a clean output. |
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Tue Apr 20, 2021 12:55 pm Post subject: |
|
|
It turns out that `cargo tree --all-features --prefix none` gives me an incomplete dependency list.
cargo-ebuild also gives me an incomplete list.
I had to manually add dependencies from Cargo.lock.
I think I will write Cargo.lock parser in janet language. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21635
|
Posted: Tue Apr 20, 2021 2:57 pm Post subject: |
|
|
crocket wrote: | I think I will write Cargo.lock parser in janet language. | If your goal is to make packaging easier for people in general, wouldn't it be better not to require them to install yet another language just so they can use your tool to work around the problems in Rust? |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3345 Location: Rasi, Finland
|
Posted: Tue Apr 20, 2021 4:06 pm Post subject: |
|
|
I'm with Hu on this.
On Gentoo, you can expect people having bash (posix also), (g)awk and python of interpreted languages to be installed.
Of course simple C and C++ code can be compiled without extra hassle. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
mustafasalih1993 n00b
Joined: 09 Feb 2021 Posts: 38
|
Posted: Tue Apr 20, 2021 6:02 pm Post subject: |
|
|
crocket wrote: | I think I will write Cargo.lock parser in janet language. |
if you write it in Rust, I'll be happy to help |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21635
|
Posted: Tue Apr 20, 2021 8:39 pm Post subject: |
|
|
If he writes it in Rust, how could he ever package it? He'd need a package of it before he could package it. I suppose this would follow Rust's pattern though. You must install Rust before you can compile it. |
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Wed Apr 21, 2021 2:21 am Post subject: |
|
|
It takes very little time to compile janet. It is very easy to package janet libraries and janet programs. Janet integrates very well with gentoo's packaging system.
I host janet eclasses in my own overlay.
Janet has https://janet-lang.org/docs/peg.html which is better than regular expression. I often use PEG to parse text.
Janet's niche is small-scale system scripting. Parsing text for other packaging systems is a form of system scripting. It's good for creating little utilities. |
|
Back to top |
|
|
mustafasalih1993 n00b
Joined: 09 Feb 2021 Posts: 38
|
Posted: Wed Apr 21, 2021 5:57 pm Post subject: |
|
|
Hu wrote: | You must install Rust before you can compile it |
since it will be a parser for a Rust projects to write a Rust Ebuilds, i thought the user's/dev's machine will already have Rust installed for compiling and testing the Ebuild
sorry for my bad English Im not a native English speaker |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21635
|
Posted: Wed Apr 21, 2021 6:24 pm Post subject: |
|
|
That might be the case, at least for some users, but I could not pass up the opportunity to poke fun at the bootstrapping loop that the Rust project refuses to see as a problem. |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1531 Location: South America
|
Posted: Wed Apr 21, 2021 10:16 pm Post subject: |
|
|
What I find curious is the event that spawned all this discussion about creating yet another tool: that both dev-util/cargo-ebuild and cargo tree apparently failed to produce a complete list of dependencies for at least one package. I don't do Rust, but it would be interesting to know how did that happen here. |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2008
|
Posted: Thu Apr 22, 2021 9:23 am Post subject: |
|
|
Hu wrote: | ...You must install Rust before you can compile it. |
Obviously a limitation, but isn't that also true of gcc? _________________ Greybeard |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Thu Apr 22, 2021 9:43 am Post subject: |
|
|
Goverp wrote: | Hu wrote: | ...You must install Rust before you can compile it. |
Obviously a limitation, but isn't that also true of gcc? |
Not quite: I think you can cross-compile gcc if you have at least one running decent C-compiler, and gcc provides everything to bootstrap from this (and does it somewhat automatically). For rust, OTOH, you need a rather recent version, and if you don't have, you might have to do the bootstrap manually, passing over possibly many rust versions. I never tried, but it might be rather tedious or even impossible to get sources for a first rust version which can be compiled from some other language than rust (not to speak about getting the sources for all of the intermediate versions you need). |
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Thu Apr 22, 2021 10:42 am Post subject: |
|
|
Ideally, Assembly -> C -> Rust -> Other higher-level languages like janet |
|
Back to top |
|
|
mikb Tux's lil' helper
Joined: 14 Dec 2005 Posts: 120 Location: Sydney Australia
|
Posted: Tue Nov 09, 2021 5:32 am Post subject: |
|
|
Goverp wrote: | Hu wrote: | ...You must install Rust before you can compile it. |
Obviously a limitation, but isn't that also true of gcc? |
This is very off-topic....
Actually no, all you require to build gcc is a C compiler - any C compiler. Compiling GCC proceeds in two stages: compiling gcc with the available C compiler, then using the result of that to compile gcc with itself. It's even possible to separate the two stages. I once bootstrapped gcc on a commercial unix system where the C compiiler was an expensive add on, but the headers were available. Stage 1 was built on a machine with another architecture, then moved to the target, and Stage 2 proceeded from there.
I guess K&R must have hand coded their original PDP-11 C compiler, either in assembler or B or BCPL, but after that, it hasn't actually been necessary to do so - which was the point of C in the first place. _________________ With sufficient thrust, pigs fly just fine (RFC 1925, apparently talking about Gentoo) |
|
Back to top |
|
|
|