Hello,
I would like to propose the following tool as a Fedora page: https://gitlab.com/troelsarvin/topnfiles/
I have RPM-packaged other software before, but never Rust-based software. So I have some questions.
I've been reading https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/ where I'm wondering: It states "The RPM macros that provide basic functionality for building Rust code are included in rust-rpm-macros". What's "rust-rpm-macros", I cannot find such a package.
When I run "rust2rpm ." in my Git clone, I get the following error: ERROR: 400 Client Error: Bad Request for url: https://crates.io/api/v1/crates/7.0.0/download
And then I have a general question: Does packing for Fedora require that the software exist on crates.io?
Kind regards, Troels Arvin
I got a bit further, and the 400 Client Error is gone. I added a .spec file into release tar files. Having downloaded a release tar ball, I try to build, but it fails:
$ rpmbuild -tb topnfiles-4.1.2.tar.gz ... Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.DUSPMl + umask 022 + cd /home/troels/rpmbuild/BUILD/topnfiles-4.1.2-build + cd topnfiles-4.1.2 + /usr/bin/cargo2rpm --path Cargo.toml buildrequires --with-check + RPM_EC=0 ++ jobs -p + exit 0 error: Failed build dependencies: (crate(anyhow/default) >= 1.0.0 with crate(anyhow/default) < 2.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(chrono) >= 0.4.0 with crate(chrono) < 0.5.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(chrono/clock) >= 0.4.0 with crate(chrono/clock) < 0.5.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(clap/cargo) >= 4.0.0 with crate(clap/cargo) < 5.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(clap/default) >= 4.0.0 with crate(clap/default) < 5.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(clap/wrap_help) >= 4.0.0 with crate(clap/wrap_help) < 5.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(env_logger/default) >= 0.11.0 with crate(env_logger/default) < 0.12.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(log/default) >= 0.4.0 with crate(log/default) < 0.5.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(regex/default) >= 1.11.0 with crate(regex/default) < 2.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(serde/default) >= 1.0.0 with crate(serde/default) < 2.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(serde/derive) >= 1.0.0 with crate(serde/derive) < 2.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(serde_json/default) >= 1.0.0 with crate(serde_json/default) < 2.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(tempfile/default) >= 3.21.0 with crate(tempfile/default) < 4.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(utf8-supported/default) >= 1.0.0 with crate(utf8-supported/default) < 2.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 (crate(walkdir/default) >= 2.5.0 with crate(walkdir/default) < 3.0.0~) is needed by topnfiles-4.1.2-1.fc42.x86_64 Wrote: /home/troels/rpmbuild/SRPMS/topnfiles-4.1.2-1.fc42.buildreqs.nosrc.rpm
How can I proceed?
On Sun, Aug 31, 2025 at 6:38 PM troels--- via Rust rust@lists.fedoraproject.org wrote:
Hello,
Hi!
I would like to propose the following tool as a Fedora page: https://gitlab.com/troelsarvin/topnfiles/
I have RPM-packaged other software before, but never Rust-based software. So I have some questions.
I've been reading https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/ where I'm wondering: It states "The RPM macros that provide basic functionality for building Rust code are included in rust-rpm-macros". What's "rust-rpm-macros", I cannot find such a package.
Yeah, the docs are outdated - the packages names are now rust-srpm-macros (note the "s") and cargo-rpm-macros.
When I run "rust2rpm ." in my Git clone, I get the following error: ERROR: 400 Client Error: Bad Request for url: https://crates.io/api/v1/crates/7.0.0/download
Yeah, that's not a supported argument on the CLI. I recommend reading "man rust2rpm" for a quick overview of the CLI and all available flags.
And then I have a general question: Does packing for Fedora require that the software exist on crates.io?
It does not. It makes things easier (because more things can be automated), but it's definitely not required. Also, projects that consist of multiple crates (cargo workspaces) are often much easier to package from a tarball (i.e. from GitHub or GitLab).
$ rpmbuild -tb topnfiles-4.1.2.tar.gz
I have never seen this command before, but it looks like you're attempting to use some rather non-standard way of building RPM packages. Usually .spec files and source tarball are separate. You can put them into the same directory, run "fedpkg srpm" to build your .src.rpm package.
error: Failed build dependencies: ...
... and that error comes from the fact that you're not using `mock` to build the package. Rust packages use some (relatively) modern features of RPM that make them very awkward to build with plain "rpmbuild". You need to use `mock` to build the package, which will prepare an isolated build chroot, and pull in the required dependencies.
Fabio