I have a sample rust app, I wanted to package it up as rpm file, but currently not able to do so because I always getting this error.
error: no matching package named `rand` found
location searched: registry `crates-io`
required by package `hello_rust_dependencies v0.1.0 (/home/jlee/rpmbuild/BUILD/hello-rust-dependencies)`
error: Bad exit status from /var/tmp/rpm-tmp.brtRMA (%build)
Seems like cargo could find crate dependencies in this case? But I tried cargo build and cargo package and these were all fine, only rpmbuild gives this error, so... I wonder if I missed something in my spec file or is there other things in my project before I could start packaging it?
Update
To further explain my goals, I'm now trying to use open-build-service by openSUSE, I even setup a brand new openSUSE environment so I could exactly copy the steps in their guide. But I still failed, it still could now find the crate 'rand'...
Temporary solution (maybe)
I came across this cargo extension cargo-rpm, and successfully build an .rpm package at last. However the inner work of this tool was running cargo build first and then package the binaries into rpm file, it doesn't feels so right by doing this way because it will be against the Rust packaging guideline that @marbu mentioned. And knowing that both Fedora and OpenSUSE has their own guide for packaging Rust app, I still believe it could be done without using additional tools.