So, I’m trying to figure out how exactly Rust packaging works, and it’s a bit…confusing.
To start with I went to the packaging guidelines and found a page for Rust, but it says:
This document is applicable only for Fedora Rawhide. Stable releases do not contain any crates. However, this document can be used to build modules with Rust applications (with crates filtered out).
Thus, I decided to open up the spec file for a Rust package, at which point things became…more confusing:
- All the packages under
modules/are labeled as “demodularized”.
- The standard RPMs have no branches for anything post F29, so I’m guessing stable releases follow master? But…
- All of the packages I found specified crates in
BuildRequires, e.g. fd-find, ripgrep, exa.
True to the packaging guidelines, none of the crates seem to be available:
$ sudo dnf whatprovides 'crate(grep/default)' Last metadata expiration check: 4:43:15 ago on Wed 26 Aug 2020 10:45:56 AM CDT. Error: No Matches found
As expected, Rust packages can’t download from the network either:
$ rpm --eval '%cargo_prep' ( set -eu /usr/bin/mkdir -p .cargo cat > .cargo/config << EOF [...] [source] [source.local-registry] directory = "/usr/share/cargo/registry" [source.crates-io] registry = "https://crates.io" replace-with = "local-registry" EOF /usr/bin/rm -f Cargo.lock )
With all of this in mind, I’m honestly at a loss as to how you would package a Rust binary. What am I missing here?