Hello everyone,

I've just released a Cargo subcommand for building RPMs called cargo-rpm:

https://crates.io/crates/cargo-rpm

I've tried to avoid heavy handed abstractions and have implemented it in such a way that it does as little as possible, which is effectively two things:

- `cargo rpm init`: a one-time command which automatically generates an RPM spec from Cargo.toml metadata, intended to be checked-in

- `cargo rpm build`: creates a target/release/rpmbuild directory, copies the spec into the SOURCES directory (after templating in a version number), creates a tarball of release artifacts (and other optional files) in the SOURCES directory, then spawns "rpmbuild" as a subprocess, having it place the resulting RPM in target/release/rpmbuild/RPMs/<arch>

Since releasing this I've found out this sort of thing is being worked on in the Rust CLI WG:

https://github.com/rust-lang-nursery/cli-wg/issues/8

...and have also discovered rust2rpm. I think rust2rpm might have slightly different goals though? Where cargo-rpm is designed to instrument a project to build RPMs using the cargo workflow, it seems rust2rpm is more targeted at retroactively building RPMs from crate releases.

My main intended usage of cargo-rpm is packaging releases of internal CLI tools for internal repositories, however if there's interest in using it for packaging releases of Rust projects for official repos, I'm happy to accommodate changes necessary to make that happen.

If nothing else I'd love some feedback on the spec files I'm generating. Here's the template:

https://github.com/iqlusion-io/crates/blob/master/cargo-rpm/templates/spec.hbs

--
Tony Arcieri